Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Login failed for user

Author  Topic 

nitish
Starting Member

1 Post

Posted - 2007-01-16 : 02:18:13
hi im using asp.net for my final year project.

actually im having trouble to open my database. My connection sting is the default one - obtained from the properties: [myconnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\HOL\Web\Starter\VB\asf\App_Data\asfdb.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;"]

And im having the msg Cannot open user default database. Login failed.
Login failed for user 'USERNAME'.

plz can any1 help me out. Plz

thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-16 : 02:22:04
According to www.connectionstrings.com, your connection string should look like (using ODBC)
Driver={SQL Native Client};Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;
or using OLE DB provider
Provider=SQLNCLI;Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-16 : 02:22:59
Also make sure the default account for ASP (iusr_machine) has appropriate permission on the sql server.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-16 : 02:29:07
Or using .Net
Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -