ListInstalledInstances doesn't return a string?
From: BartMan (anonymous_at_discussions.microsoft.com)
Date: 05/17/04
- Next message: Stephanie Jones: "Not Able to Create/Remove DSNs"
- Previous message: AmazingWolf: "ODBC 3.0 and unicode"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 17 May 2004 08:06:03 -0700
Greetings,
I have 2 instances of msde sql server 2000 sp3 installed on my computer with windows xp professional.
I am doing development using visual C++ 2003, and I can get a list of the sql servers found on our network.
But when I try to do a "ListInstalledInstances" I always get back a "null" string. Do I have to do something with security to allow for this?
Here is a code snippet of what I am doing:
HRESULT CDlgSqlServerList::AddSQLSvrInstances(CComBSTR strSvrName)
{
_SQLServer2Ptr spSQLServer;
HRESULT hr = spSQLServer.CreateInstance(__uuidof(SQLServer2));
if(FAILED(hr)) return hr;
NameListPtr listInstances;
_variant_t varServ(strSvrName);
hr = spSQLServer->raw_ListInstalledInstances(varServ,&listInstances);
if(FAILED(hr)) return hr;
if(listInstances == NULL) return S_OK;
LONG lInstanceCount = 0;
hr = listInstances->get_Count(&lInstanceCount);
if(FAILED(hr)) return hr;
for(LONG lIndex=0;lIndex<lInstanceCount;lIndex++)
{
CComBSTR strInstance;
hr = listInstances->raw_Item(CComVariant(lIndex), &strInstance);
if(FAILED(hr)) continue;
CStringW sInstance;
sInstance.Format(L"%s",(LPWSTR)strInstance);
ATLTRACE(L"%s\n",sInstance);
}
}
For some reason I get a count of "1" from the "listInstances->get_Count()", but there is never a value in the string.
I use the name "(local) for the server name. (which I had enumerated using "ListAvailableSQLServers")
Any ideas as to what I am doing wrong?
Thanks in advance for any help.
- Next message: Stephanie Jones: "Not Able to Create/Remove DSNs"
- Previous message: AmazingWolf: "ODBC 3.0 and unicode"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|