Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am Using Vb.net.
I want to Use Sql Mdf Db as Attached Db (Without Sql Server).
I Already Attached Mdf File For Single User but When I am Using in Another System via Lan Or Network Drive then Error Showing Process With Another.
Please Explain How I can Work in 2 Or More System Without Sql Server With Attached Mdf File Using Localdb.

What I have tried:

"Server=(localdb)\v11.0;Integrated Security=true;AttachDbFileName=" & Application.StartupPath & "\Dbp.Mdf;"
Posted
Updated 2-Oct-22 23:23pm
v2

You can ... just stick the DB file on a shared folder and let the remote connect to it.

But ... it's a really bad idea. Yes, it can be done; yes, it can work. But every single time I've done it it's caused more problems than it's solved. Access is primarily a single user DB, and it really doesn't work well with multi user access. It'll mostly work, provided that you connect, use, and disconnect every time you use it; that you handle errors gracefully with competent retries built in; that you never make any assumptions about your data. Fail once, and it'll bite you on the ass, and bite hard.

Use SQL Server or MySql instead - it may seem like more work, but long term it's so much easier and more reliable.
 
Share this answer
 
Comments
Richard Deeming 3-Oct-22 5:20am    
LocalDB is SQL Server, not MS Access. :)
OriginalGriff 3-Oct-22 5:28am    
Yes I know. But he's trying to do it without a server installation, I think.
Soft Management 18-Oct-22 13:44pm    
Yes i want like this
OriginalGriff 18-Oct-22 14:01pm    
No, you don't. It'll all end in grief, I've been there and it's far more trouble than it's worth ...
LocalDB is, as the name suggests, a local database. Trying to share it between multiple users isn't going to end well.

And the AttachDBFileName option is an extremely bad idea. SQL Server will create a separate user instance for each running instance of your application, and you won't be able to open the same database file from multiple instances.

Instead, create a proper instance of SQL Server, and create a proper database within that instance. All of your application instances can then connect to that existing database, and there won't be any file-sharing issues.
 
Share this answer
 

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