Hi,
I'm trying to connect to a sql db with my C# applciation but I'm having
trouble to connect..
It said - Error accessing the database: Cannot open database "LibDB"
requested by the login. The login failed.
but I didn't create any username and password, so I don't know how to
solve the problem? Can someone help me? It's my first time trying to
connnect to a sql database.
Here's my code:
SqlConnection cnn1 = new SqlConnection();
cnn1.ConnectionString = "Integrated Security=SSPI;" +
"Initial Catalog=LibDB;" +
"Data Source= .\\SQLExpress";
try
{
//open connection
cnn1.Open();
Console.WriteLine("Connection Suceeded");
//open connection
cnn1.Close();
Console.WriteLine("Connection Closed");
}
catch(Exception e)
{
Console.WriteLine("Error accessing the database: " +
e.Message);
}
Cheers!
Claudi
*** Sent via Developersdex http://www.developersdex.com ***