我已經在c#中開發了Windows窗體應用程序。我用這個Microsoft Visual Studio 2010.現在我想要生成安裝包(或者讓我把程序給人的東西),但是我遇到了一些奇怪的問題。程序創建安裝包後沒有看到數據庫
當我使用調試模式 - 一切工作正常,所以我從MyDocuments \ Visual 2010 \ Solution name \ Project Name \ bin \ Debug編譯的程序,並把它給我的妻子來測試它......但在她的計算機程序沒有運行,給這個錯誤:
System.Data.SqlClient.SqlException: An error has occurred with the onset of the network or connect to a SQL Server server. Can not find server or it is not available. Verify that the instance name is correct and that the configuration of SQL Server allow remote connections. (Provider: SQL Network Interfaces, error: 26 - Error locating a specific server/instance)
in System.Data.ProviderBase.DbConnectionPool.GetConnection (DbConnection owningObject)
in System.Data.ProviderBase.DbConnectionFactory.GetConnection (DbConnection owningConnection)
in System.Data.ProviderBase.DbConnectionClosed.OpenConnection (DbConnection outerConnection, DbConnectionFactory connectionFactory)
in System.Data.SqlClient.SqlConnection.Open()
in System.Data.Common.DbDataAdapter.QuietOpen (IDbConnection connection, ConnectionState & originalState)
in System.Data.Common.DbDataAdapter.FillInternal (DataSet dataset, DataTable [] DataTables, Int32 startRecord, Int32 MaxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill (DataTable [] DataTables, Int32 startRecord, Int32 MaxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill (DataTable dataTable)
in Home_Video_Catalog.HVCDBDataSetFilmsTableAdapters.FilmsTableAdapter.Fill (FilmsDataTable dataTable) in C: \ Documents and Settings \ Aru \ My Documents \ Visual Studio 2010 \ Projects \ Home Video Catalog \ Home Video Catalog \ HVCDBDataSetFilms.Designer.cs: line 868
in Home_Video_Catalog.MainWindow.MainWindow_Load (Object sender, EventArgs e) in C: \ Documents and Settings \ Aru \ My Documents \ Visual Studio 2010 \ Projects \ Home Video Catalog \ Home Video Catalog \ MainWindow.cs: line 27
in System.Windows.Forms.Form.OnLoad (EventArgs e)
in DevComponents.DotNetBar.Office2007RibbonForm.OnLoad (EventArgs e)
in System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl (Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
in System.Windows.Forms.Control.WmShowWindow (Message & m)
at System.Windows.Forms.Control.WndProc (Message & m)
in System.Windows.Forms.ScrollableControl.WndProc (Message & m)
in System.Windows.Forms.ContainerControl.WndProc (Message & m)
in System.Windows.Forms.Form.WmShowWindow (Message & m)
in System.Windows.Forms.Form.WndProc (Message & m)
in DevComponents.DotNetBar.Office2007RibbonForm.WndProc (Message & m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage (Message & m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc (Message & m)
at System.Windows.Forms.NativeWindow.Callback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
...所以我想,如果可能,如果我創建安裝項目,併爲我的項目設置這將是確定......但錯誤與之前的錯誤代碼相同。
我不太明白,becouse在我的配置文件中的項目(的app.config並在項目屬性\ settings.settings)是正確的連接字符串:
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\HVCDB.mdf;Integrated Security=True;User Instance=True"
也是有趣的是,路徑在錯誤消息是我的計算機上有效(這是我一直的項目)
請幫我:)