K
K Viltersten
I'm getting "connection not initialized" for
error when running the following code.
string conStr =
"Persist Security Info=True;"
+ "User ID=sa;Password=passpass;"
+ "Initial Catalog=TheNameOfDataBase;"
+ "Data Source=LP028\\SQLEXPRESS;";
SqlConnection con = new SqlConnection(conStr);
SqlCommand cmd =
new SqlCommand("select * from the_table");
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Why?! As far i can see, it should work. The
only part i'm unsure about is the connection
string but it's copied directly from an other
project where it works...
Could it be something simple in the config
file, perhaps? The one i have access to is so
large that it's not possible to get throug it
as a whole...
error when running the following code.
string conStr =
"Persist Security Info=True;"
+ "User ID=sa;Password=passpass;"
+ "Initial Catalog=TheNameOfDataBase;"
+ "Data Source=LP028\\SQLEXPRESS;";
SqlConnection con = new SqlConnection(conStr);
SqlCommand cmd =
new SqlCommand("select * from the_table");
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Why?! As far i can see, it should work. The
only part i'm unsure about is the connection
string but it's copied directly from an other
project where it works...
Could it be something simple in the config
file, perhaps? The one i have access to is so
large that it's not possible to get throug it
as a whole...