|
-
September 21st, 2001, 06:49 AM
#1
SQL Server Ado Connection fails
I cannot seem to get my application to connect with my SQL Server. I am constantly getting the error message "Login Failed for user Administator". I am not specifying a longin name or a password. I just installed the SQL Server 7.0 developer edition. I created a new Database. It created a default server on installation, and has 2 logins (That I did not create!) 1/ Administator 2/ sa. I don't know the password for either of the logins since I did not create them. I installed SQL Server on my machine which has Windows NT and is connected to a network. I think it may have taken administrator from there.
Anyway, here is the code I tried, any help that could be provided please do:
BOOL CSchedulerDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
HRESULT hr;
CString strConn = "Provider=sqloledb;server=comp_acer9;database=Project_Data.mdf";
//make connection
try{
hr = m_pConnection.CreateInstance(__uuidof(Connection));
if(SUCCEEDED(hr))
{
hr = m_pConnection->Open(_bstr_t(strConn), _bstr_t(L""), _bstr_t(L""), adModeUnknown);
if(SUCCEEDED(hr))
{
m_bIsConnectionOpen = TRUE;
}
}
}
catch(_com_error &e)
{
_bstr_t bstrError = e.Error();
_bstr_t bstrDesc = e.Description();
TRACE(bstrError); //returns -2147217843(1)
TRACE(bstrDesc); //returns "Login Failed for user 'Administrator'."(1)
}
catch(...)
{
}
return TRUE;
}
Thanks in advance!
Mike B
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|