connection string pains and stuff…

I just hate going to bed when I’ve got a problem I’m trying to work through.  I was up until early this morning trying to figure out what’s wrong with my connection string to the Db.  I did some research on the net and found that Sql Express 2005 looks like it can use the old format of…

“Datasource=servername;Initial Catalog=someDatabase;”

and the new format of…


What’s strange is that neither way works.  :-\  I keep getting an access denied or database doesn’t exist error.  I’ll keep working on it tonight…it’s probably some little thing that I’m missing or something, because I can make a data connection to it just fine through SharpDevelop, just not through code for some reason.  *shrug*

If anyone could point me to a good location to read up on connection strings for Sql Express 2005 that would rock.  🙂

Comments (2)

  1. You simply have to specify the correct server name in the form serverinstance. The default instance you can connect to is .sqlexpress

  2. Toffer says:

    that’s what I was using. I’ve tried a bunch of different combinations…here’s the code I was last trying last night to set my connection string…

    SqlConnection sqlCon = new SqlConnection();

    sqlCon.ConnectionString = @Server=.SQLEXPRESS;Integrated Security=True;Database=MovieData;Persist Security Info=False";

    I’ve tried this with and without the "Integrated Security" & "Persist Security Info" there as well.