I had created a sql database with SQL 2008 express and the database is saved in a folder (not network). In my MFC application, I wish to open this database but it always prompts SQL server login dialog. I wonder why it cant get the database open?
CDatabase database;
CString SqlString;
CString sDriver = "SQL Server";
CString sDsn;
CString sFile = "C:\\MyFolder\\Libraries.mdf";
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);
if(database.Open(NULL,false,false,sDsn))
AfxMessageBox("database opened!");
else{
.....
}
Can someone tell me why?