使用C#应用程序实现数据库连接

使用C#应用程序实现数据库连接

问题描述:

假设我在localhost上有一个数据库。我想用它连接一个C#应用程序。

我想把数据库文件本地放到那个应用程序中,每次都从那里拿起它。我不需要提供数据库路径。

应用程序:myapplication.exe

数据库:file.mdf和file_log.ldf。等等



请连接字符串解决方案。

谢谢

Suppose I have a database on localhost. I want to connect a C# application with it.
I want to just put database file local to that application and it pick it up from there each time. I don''t need to give database path.
Application: myapplication.exe
Database: file.mdf and file_log.ldf. etc

Please a connection string solution.
Thanks

否它不会工作。 .mdf和.ldf 是SQL Server文件,如果没有SQL Server引擎,您无法直接与这些文件交互。



另请查看 [ ^ ]
No It wont work. .mdf and .ldf are SQL Server files you cannot interact directly with these files without SQL Server Engine.

Also check this[^]