2.0: error opening ASPNETDB

R

RAM

Hello,
I have written simple ASP.NET application with logging in. I need to
open ASPNETDB database to read some information which is not available
using class library (custom table).
I have written:

using (SqlConnection aspnetdb = new
SqlConnection(ConfigurationManager.ConnectionStrings["ASPNETDB"].ConnectionString))
{
aspnetdb.Open(); // here problem
...
}
In web.config I have:
<add name="ASPNETDB" connectionString="Data
Source=localhost;Initial catalog=MIMMagazynASPNETDB;Integrated
Security=True;User Instance=True"/>

The problem occurs on opening ASPNETDB:
aspnetdb.ServerVersion...Message is "Invalid operation. The connection
is closed."
aspnetdb.ServerVersion...StackTrace is
" at System.Data.SqlClient.SqlConnection.GetOpenConnection()\r\n
at System.Data.SqlClient.SqlConnection.get_ServerVersion()"

Please help.
/RAM/

PS. I really need to open ASPNETDB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top