Home > Net >  Not install SQL Server, c # how to connect the MDF file?
Not install SQL Server, c # how to connect the MDF file?

Time:10-07

 string STR=@ "Data Source=. \ SQLEXPRESS; AttachDbFilename=C: \ test. MDF; 
Integrated Security=True; The Connect Timeout=30; The User Instance=True ";
SqlConnection Con=new SqlConnection (STR);
Con. The Open ();

Normal connection MDF file in this way, but in the absence of installing SQL Server on a computer, in what way can connect local MDF files?

If can't achieve, SQL MDF Viewe how

No SQL on the computer, I also didn't find SQLExpress service

CodePudding user response:

And this operation?? True have never seen..

In front of it..

CodePudding user response:

Here with the SQL client components (DLL) connection, instead of SQL Server software,

CodePudding user response:

Using ODBC
"The Provider=Microsoft. Jet. The OLEDB. 4.0. Data Source="+" C: \ test. MDF "

CodePudding user response:

https://blog.csdn.net/hotmee/article/details/52459959

CodePudding user response:

The
reference 3 floor xuzuning response:
using ODBC
"The Provider=Microsoft. Jet. The OLEDB. 4.0. Data Source="+" C: \ test. MDF "

Thank the moderator, I now can only use SqlConnection here. The Open () to Open the connection

reference 4 floor hanjun0612 response:
https://blog.csdn.net/hotmee/article/details/52459959


I use VS2010 DataSource without (LocalDB) \ v11.0 option (can't edit, can only choose)
LocalDB VS2012 and so add function?

Words always can't open BBS yesterday afternoon, I often encounter this kind of situation, what is this?

CodePudding user response:

refer to 6th floor qq_21420725 response:
is the building Lord finally how to solve?
Recently, I also met this problem


@ qq_21420725 I haven't solved, remember before use NuGet vs2015 download a package can support the operation, but I am vs2010 project created, then the problem lay

CodePudding user response:

 select 'this problem really fresh, wait for the results 

CodePudding user response:

The first thing you want to make sure your computer have installed SQL SERVER components package, or complete. The.net framework, otherwise can't achieve, you will have a problem is the attachment,
  •  Tags:  
  • C#
  • Related