0

enter image description here

The first error I get insists a give a provider, I have tried multiple providers I've gotten through google searches. The second error when I specify a provider does not give details it just says No work done, check OLE DB status value.

enter image description here

The connection string provided by the mdf file is

"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="C:\Users\...\AAS.mdf";Integrated Security=True". 

I also tried using

"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename="AAS.mdf";Integrated Security=True" 

and

"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=AAS.mdf;Integrated Security=True" 

since the database is in the same file as the application.

Can someone let me know how to find the correct provider if that is the problem, or fix my connection string. (PS: this application will run on multiple computers possibly in different folders so preferably a solution not specifying the C drive)

Ramil Aliyev 007
  • 4,437
  • 2
  • 31
  • 47
  • I think you will find your answer here: https://www.connectionstrings.com/sql-server-compact/ -- this is the page for SQL server compact on "connectionstrings.com" -- if this doesn't work there are details for other providers to try. – Glenn Ferrie May 03 '21 at 20:54
  • 4
    If you are using MS SQL Server, you don't want OleDBConnection, you want SqlConnection in System.Data.SqlClient namespace (https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlconnection?view=dotnet-plat-ext-5.0) – B.O.B. May 03 '21 at 20:55
  • 1
    @GlennFerrie: a `.mdf` file is a regular SQL Server database file - **not** a SQL Server Compact one (that would have been `.sdf`) – marc_s May 03 '21 at 20:56
  • 1
    If for some reason you absolutely need OleDb over the native Client, then here is OleDb connection strings for SQL Server: https://www.connectionstrings.com/ole-db-driver-for-sql-server/ – B.O.B. May 03 '21 at 20:56
  • For OleDb, the bottom of this article has an OleDb connection that is supposed to work with LocalDB: https://sysmod.wordpress.com/2014/07/11/adodb-connection-string-for-localdb-and-sql-server-native-client/ – B.O.B. May 03 '21 at 21:02
  • Does this answer your question? [what's the issue with AttachDbFilename](https://stackoverflow.com/questions/11178720/whats-the-issue-with-attachdbfilename) I really wouldn't bother with this parameter at all, it probably doesn't do what you think it does, and any case you can't use it with the OleDB driver – Charlieface May 03 '21 at 21:10
  • @B.O.B. I've converted to System.Data.SqlClient now I'm getting "A connection was successfully established with the server, but then an error occurred during the login process. (provider: Named Pipes Provider, error: 0 - No process is on the other end of the pipe" – Dumisani Zitha May 04 '21 at 17:45
  • @DumisaniZitha Well I don't know about LocalDB, the full server has 3 different protocols that can be enabled or disabled, one of which is Named Pipes. The other two are Shared Memory and TCP/IP. – B.O.B. May 05 '21 at 02:42
  • https://stackoverflow.com/questions/52298639/localdb-no-process-on-the-end-of-the-pipe see if that helps. – B.O.B. May 05 '21 at 02:45

0 Answers0