저는 C#에서 Windows 양식 응용 프로그램을 개발했습니다. 저는이 Microsoft Visual Studio 2010에 사용했습니다. 이제 설치 패키지 (또는 사람들에게 내 프로그램을 제공 할 수있게 해주는 프로그램)를 생성하고 싶지만 이상한 문제가 발생했습니다.설치 패키지를 만든 후 프로그램이 데이터베이스를 보지 못합니다.
디버그 모드를 사용할 때 모든 것이 정상적으로 작동하므로 MyDocuments \ Visual 2010 \ 솔루션 이름 \ 프로젝트 이름 \ 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 및 프로젝트에서 속성 \ settings.settings)가 적절한 연결 문자열 프로젝트에 내 config 파일에서 렸기 때문에, 그것을 얻을하지 않습니다는 :
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\HVCDB.mdf;Integrated Security=True;User Instance=True"
또한 재미있는 것은 그 경로입니다 오류 메시지가 컴퓨터에 유효하다 (이것은 어디했습니다 프로젝트)
=. \ 연결 문자열에 SQLEXPRESS 설치 SQLSERVER 익스프레스의 인스턴스를 참조 나 :