Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21942

Eksportowanie(publish) programu z visual studio 2015

$
0
0

Witam,
Napisałem program który korzysta min. z bazy danych. Potrzebuje wyeksportować projekt tak aby ktoś inny mógł go sobie zainstalować na swoim pc i mógł z niego korzystać. Po zainstalowaniu programu włącza się ale gdy przychodzi czas aby skorzystał z bazy danych to wyskakuje błąd z klauzury try{}catch{} messageBox mój z moją treścią plus wyłapany exception, a jego treść to

System.Data.SqlClient.SqlException (0x80131904): Wystąpił błąd związany z siecią lub wystąpieniem podczas ustanawiania połączenia z serwerem programu SQL Server. Nie można odnaleźć serwera lub jest on niedostępny. Sprawdź, czy nazwa wystąpienia jest poprawna i czy konfiguracja serwera programu SQL Server zezwala na połączenia zdalne.  (provider: SQL Network Interfaces, error: 52 - Nie można zlokalizować instalacji programu Local Database Runtime. Sprawdź, czy program SQL Server Express jest poprawnie zainstalowany i czy jest włączona funkcja Local Database Runtime.) ---> System.ComponentModel.Win32Exception (0x80004005): Nie można odnaleźć określonego pliku
   w System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
   w System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   w System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   w System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   w System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   w System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   w System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   w System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   w System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   w System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   w System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   w System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   w System.Data.SqlClient.SqlConnection.Open()
   w System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   w System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   w System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   w JOBBOERSE.dbContactTableAdapters.ContactTableAdapter.Fill(ContactDataTable dataTable)
   w JOBBOERSE.DataShow.DataShow_Load(Object sender, EventArgs e)
   w System.Windows.Forms.Form.OnLoad(EventArgs e)
   w System.Windows.Forms.Form.OnCreateControl()
   w System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   w System.Windows.Forms.Control.CreateControl()
   w System.Windows.Forms.Control.WmShowWindow(Message& m)
   w System.Windows.Forms.Control.WndProc(Message& m)
   w System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   w System.Windows.Forms.Form.WmShowWindow(Message& m)
   w System.Windows.Forms.Form.WndProc(Message& m)
   w System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   w System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   w System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:2,State:0,Class:20

Sam projekt znajduje się na github: Link do projektu

 

Może źle zadeklarowałem bazę danych w projekcie, albo ten fragment kodu jest nie tak:

 using (SqlConnection connection = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = " + Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + @"\AddresBook.mdf; Integrated Security = True"))

 

A tutaj sam link do pobrania wersji wyeksportowanej, czytaj do instalacji PROGRAM

Liczę na pomoc, 
Pozdrawiam,
Rout


Viewing all articles
Browse latest Browse all 21942