私はc#でWindowsフォームアプリケーションを開発しました。私はこのMicrosoftVisualStudio 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)
...だから、もしインストーラープロジェクトを作成してプロジェクトのセットアップを作成すれば大丈夫だと思っていました...しかしエラーは前のエラーコードと同じでした。
プロジェクトの設定ファイル(プロジェクトの下のapp.configとProperties \ settings.settings)に適切な接続文字列があるため、よくわかりません。
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\HVCDB.mdf;Integrated Security=True;User Instance=True"
また面白いのは、エラーメッセージのパスが私のコンピューターで有効であるということです(これは私がプロジェクトした場所です)
私を助けてください :)