【发布时间】:2016-06-05 06:43:24
【问题描述】:
我在 c# 中创建了一个测验应用程序。
我创建了一个本地数据库。当我在我的电脑上发出命令时
sqllocal info
它显示了我的数据库。它在同一台 PC 上运行良好。但是当我安装我的应用程序时出现以下错误:
但是当我在其他电脑上运行相同的应用程序时,它给了我错误
有关调用即时的详细信息,请参阅此消息的末尾 (JIT) 调试而不是此对话框。
************** 异常文本 ************** System.Data.SqlClient.SqlException (0x80131904):网络相关或 建立连接时发生特定于实例的错误 SQL 服务器。服务器未找到或无法访问。核实 实例名称正确且 SQL Server 配置为 允许远程连接。 (提供者:SQL 网络接口,错误:52 - 找不到本地数据库运行时安装。验证 SQL Server Express 是否已正确安装并且本地数据库 运行时功能已启用。)---> System.ComponentModel.Win32Exception (0x80004005): 系统找不到指定的文件 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 异常,布尔 breakConnection,Action
1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 重试,DbConnectionOptions userOptions,DbConnectionInternal& 连接)在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 重试,DbConnectionOptions userOptions)在 System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection 外部连接,DbConnectionFactory 连接工厂, 任务完成源1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 重试)在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 重试)在 System.Data.SqlClient.SqlConnection.Open() 在 System.Data.Common.DbDataAdapter.FillInternal(数据集数据集, DataTable[] 数据表,Int32 startRecord,Int32 maxRecords,字符串 srcTable、IDbCommand 命令、CommandBehavior 行为)在 System.Data.Common.DbDataAdapter.Fill(DataTable[] 数据表,Int32 startRecord、Int32 maxRecords、IDbCommand 命令、CommandBehavior 行为)在 System.Data.Common.DbDataAdapter.Fill(DataTable 数据表)在 MITCOE.TestDataSetTableAdapters.TableTableAdapter.Fill(TableDataTable dataTable) 在 MITCOE.Form2.Form2_Load(Object sender, EventArgs e)
在 System.Windows.Forms.Form.OnLoad(EventArgs e) 在 System.Windows.Forms.Form.OnCreateControl() 在 System.Windows.Forms.Control.CreateControl(布尔 fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl() 在 System.Windows.Forms.Control.WmShowWindow(Message& m) 在 System.Windows.Forms.Control.WndProc(Message& m) 在 System.Windows.Forms.ScrollableControl.WndProc(Message& m) 在 System.Windows.Forms.ContainerControl.WndProc(Message& m) 在 System.Windows.Forms.Form.WmShowWindow(Message& m) 在 System.Windows.Forms.Form.WndProc(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 味精,IntPtr wparam,IntPtr lparam) ClientConnectionId:00000000-0000-0000-0000-000000000000 错误 编号:2,状态:0,等级:20当我编写 sqllocal 信息时,它给了我
'sqllocal' 未被识别为内部或外部命令, 可运行的程序或批处理文件。
那么为什么我的 localdb 不能在其他 PC 上运行
【问题讨论】:
标签: c# mysql .net windows visual-studio