Connect to an ASP.NET SQL express db with another C# Project -
i'm working on project has front end asp.net website users submit "orders". need access specific table in database c# windows form application interacts multiple serial ports. (i'm not married idea, if think it's better idea have 1 website both functions, i'm ears)
anyway, question regarding ability have 2 connection strings (one asp.net, , other local program. - both of run on same computer)
on c# end, have connection string of:
"attachdbfilename=c:\\users\\jordan\\documents\\visual studio 2012\\websites\\website1\\app_data\\myxodata.mdf;integrated security=true;connect timeout=30;user instance=true;"
with configuration, when 1 project active, other cannot access database.
cannot open user default database. login failed. login failed user 'cmyk-164\jordan'.
i have feeling because using integrated security=true in connection string , "user instance=true" allows 1 user on computer log db @ time...but can't find backs theory...or has way around problem.
any suggestions appreciated!
edit
the connection strings not issue. both applications work when other isn't active. issue here establishing 2 concurrent connections 1 database, 2 different c# applications.
building on rafeal's response; need upgrade sql server express.
sql server express localdb stripped-down version lot of limitations; 1 being not support concurrent connections. see link below - part explaining concurrent connection limitation can found in last sentence of permissions section.
http://technet.microsoft.com/en-us/library/hh510202.aspx
you can install sql server express here:
and in visual studio can use database explorer create data connection new database create tables , stored procedures need.
if not familiar .net , sql server, can connect sql server express database using system.data.sqlclient namespace. since it's designed sql server products, supposedly more efficient using ado.net or other data providers. and, @ least, have found quick , easy use. example, since provider explicit, don't need specify provider in connection string, resulting in shorter string. more information on connection string, see page:
and can find c# , vb examples of opening connection @ bottom of page:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx
Comments
Post a Comment