Click here to Skip to main content
15,881,828 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I used two version of mdf file in my program, one is working with sql express, and one is working with localdb/ver 11, after installation of my application and sql local db 2012 i got this error at the startup of my program:
can not find sql engine in your computer.or sth like that.
Does it mean i should instal sql express 2012? I mean microsoft created the sql server local db with small size.

my error:
A network-related or instance-specific error occured while establishing a connection to
SQL server. The server was not found or was not accessible.
Verift that the instance name is correct and that SQL server is configured to allow remote connections.
(provider: SQL Network inteface, error 26-Error Locating server/instance specified)



SQL
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.


************** Exception Text **************
C#
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
   at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
   at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.Table`1.GetEnumerator()
   at System.Data.Linq.Table`1.System.Collections.Generic.IEnumerable<tentity>.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at System.Data.Linq.Provider.BindingList.Create[T](DataContext context, IEnumerable`1 sequence)
   at System.Data.Linq.Table`1.GetNewBindingList()
   at System.Data.Linq.Table`1.System.ComponentModel.IListSource.GetList()
   at System.Windows.Forms.CurrencyManager.SetDataSource(Object dataSource)
   at System.Windows.Forms.CurrencyManager..ctor(Object dataSource)
   at System.Windows.Forms.BindingContext.EnsureListManager(Object dataSource, String dataMember)
   at System.Windows.Forms.DataGridView.DataGridViewDataConnection.ShouldChangeDataMember(Object newDataSource)
   at System.Windows.Forms.DataGridView.set_DataSource(Object value)
   at Serial_port_exporter.Form1.Form1_Load(Object sender, EventArgs e) in I:\Majid projects\Serial port exporter\majid-serial port exporter-1-14-2013\Serial port exporter 2\Serial port exporter\Form1.cs:line 753
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.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)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Serial port exporter
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Farzad/AppData/Roaming/Locator/Serial%20port%20exporter.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
ZedGraph
    Assembly Version: 5.1.5.28844
    Win32 Version: 5.1.5.28844
    CodeBase: file:///C:/Users/Farzad/AppData/Roaming/Locator/ZedGraph.DLL
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data.DataSetExtensions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.DataSetExtensions/v4.0_4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
----------------------------------------
System.Numerics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
System.Data.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Data.Linq.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitdebugging="true">


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Posted
Updated 18-Jan-13 4:00am
v5
Comments
Herman<T>.Instance 18-Jan-13 9:11am    
this is a famous small settings issue in Sql Server Configration Manager.
First checkyour connectionstring . Check if the setted server really exists and then in the Configuration manager set the appropraite settings for Network Configuration (TCp/IP)
F.moghaddampoor 18-Jan-13 9:48am    
Well i don't know where this configuration manager you are talking about is?
are you mentioning the configuration manager in visual studio?
and where is Network configuration? and what does this setting do?
F.moghaddampoor 18-Jan-13 9:59am    
my error:
A network-related or instance-specific error occured while establishing a connection to
SQL server. The server was not found or was not accessible.
Verift that the instance name is correct and that SQL server is configured to allow remote connections.
(provider: SQL Network inteface, error 26-Error Locating server/instance specified)
F.moghaddampoor 18-Jan-13 12:03pm    
I found the bug here, I'm sure about my connection string. its microsoft bug.

if you want to use sql local db 2012 for .net 4.0, it's impossible unless we add the update for .net framework 4.0 and that would be

Update 4.0.2 for Microsoft .NET Framework 4 – Runtime Update

So on client computer we should instal .NET Framework 4.02 instead of 4.0

However next problem is how to instal this pack silently!

1 solution

You may have seen this already, but I thought I'd pass it on anyway: SQL Server Expres 2012 local...[^]
It could be as simple as your connection string not being correct as the source I linked to talks about a "special connection string".
The easiest way to use LocalDB is to connect to the automatic instance owned by the current user by using the connection string "Server=(localdb)\v11.0;Integrated Security=true". To connect to a specific database by using the file name, connect using a connection string similar to "Server=(LocalDB)\v11.0; Integrated Security=true ;AttachDbFileName=D:\Data\MyDB1.mdf".
 
Share this answer
 
Comments
F.moghaddampoor 18-Jan-13 9:45am    
Well i don't know but didn't visual studio make the coonections before?

i mean i think visual studio connects the mdf files automatically.
F.moghaddampoor 18-Jan-13 9:46am    
Specially i used linq to sql in my program
F.moghaddampoor 18-Jan-13 9:59am    
my error:
A network-related or instance-specific error occured while establishing a connection to
SQL server. The server was not found or was not accessible.
Verift that the instance name is correct and that SQL server is configured to allow remote connections.
(provider: SQL Network inteface, error 26-Error Locating server/instance specified)
fjdiewornncalwe 18-Jan-13 11:14am    
I agree that Studio usually makes the connections. I didn't read the entire page, but I got the impression that this was a special case that needed a special, non standard connectionstring which is why I mentioned it. You could check your .config file for your application and see what connection string was written there and if it conforms to the one in the MSDN article. Beyond that, I'm not too sure where to go.
F.moghaddampoor 18-Jan-13 12:02pm    
I found the bug here, I'm sure about my connection string. its microsoft bug.

if you want to use sql local db 2012 for .net 4.0, it's impossible unless we add the update for .net framework 4.0 and that would be

Update 4.0.2 for Microsoft .NET Framework 4 – Runtime Update

So on client computer we should instal .NET Framework 4.02 instead of 4.0

However next problem is how to instal this pack silently!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900