I try to access a same database using two different system,

a) a window based system and
b) a web based system.

Both are using VB.NET. But it seem like the there is either one of them can access the database at a time. When one of them running, the other system unable to access. The error is

"Cannot open user default database. Login failed. Login failed for user 'PY1234\Jen'."

PY1234/Jen is a window authoization.
I was using MS SQL Sever Express 2005 and the connection string are

<connectionStrings>
<add name="WhyWhy.My.MySettings.BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\bin\Debug\BookShop.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

As a conclusion i need the database to be connected by multiuser at the same time
Any help is appreciated.

Recommended Answers

All 3 Replies

why are you attaching the database every time?

if you attach it, then the second user doesn't need to attach it since it's already there....

Dont run the Database everytime u try connecting to it.
Just run that once and establish the connection ,after that i dont think there would be a problem connecting multiusers to the same database.

Thank you for the reply.
I have try to change the connection string to

<connectionStrings>
<add name="WhyWhy.My.MySettings.BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;"
providerName="System.Data.SqlClient" />
</connectionStrings>

but it still cannot connect, i have change it to

<connectionStrings>
<add name="WhyWhy.My.MySettings.BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\bin\Debug\BookShop.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False"
providerName="System.Data.SqlClient" />
</connectionStrings>

Although it works for the time, could it be wrong? Coz i still need to attach the db everytime.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.