How to connect to database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a database using vb express 2005 and now am trying to access it using a sql connection.
Here is the connection string:
ConnString = "Data Source= .\SQLEXPRESS;Initial Catalog = |Data Directory|\trail-db.mdf;Integrated Security=SSPI;Persist Security Info=True;"

When I try to debug, it gives a sqlexception error saying it cant open the database due to login failure. I thought using SSPI would force it into windows authentication but I am doing something wrong. Can anyone help?
 
Noob,

You can try to make a connectionstring included in the Data tab.

Cor
 
Shouldn't the connection string have been something like :

ConnString = "Data Source= .\SQLEXPRESS; AttachDbFilename=|Data
Directory|\trail-db.mdf; Initial Catalog=<MyDatabase>; Integrated
Security=True;Persist Security Info=True;"

Regards,

Cerebrus.
 
Cerebrus

Can be but this can even be more than enough, but this can in my idea not be
the problem.

"Server=.\SQLExpress; DataBase=HKW; Integrated Security=SSPI"
Cor
 
Cerebrus said:
Shouldn't the connection string have been something like :

ConnString = "Data Source= .\SQLEXPRESS; AttachDbFilename=|Data
Directory|\trail-db.mdf; Initial Catalog=<MyDatabase>; Integrated
Security=True;Persist Security Info=True;"

Regards,

Cerebrus.

Cor Ligthert [MVP] wrote:
Thanks Cerebrus & Cor
Changing it to AttachDbFilename corrected the problem.
 
Kinda off topic but if I develop an application that uses SQL Express
database's, then any user's machine trying to run the applicaiton must also
have SQL Express installed to run...is this correct?
 
No, it has to be installed on one users machine or on a machine all the
users can get to.

BTW, I am the Access Developer's Workshop SIG leader at HAL-PC. We are
holding a hands-on lab for SQL Express this Saturday from 9 am - noon.
You are invited to attend. Check www.hal-pc.org for directions.

Robert also in Houston
 
Back
Top