Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages
Started by Daryl
Tue, 24 Apr 2007 09:44
ODBC API Problem, looking for SQL Servers - local, remote OK
Author: Daryl
Date: Tue, 24 Apr 2007 09:44
Date: Tue, 24 Apr 2007 09:44
48 lines
2687 bytes
2687 bytes
Hi
I have a problem with an application that I have been using for quite a time
with WIN 2000, 2003, XP. I am now having a problem with it using Borland
Builder ver 5 to compile on Vista Buisness and a local install of Microsoft
SQL Server 2005.
The application uses the ODBC API to browse for SQL servers. The problem is
that when it browsers for SQL servers the local server is shown as (loc not
(local) or NOAH which is its name. The code that returns the string that
contains the servers is shown below.
//---------------
bool __fastcall TfrmFindServer::FindServers(TStringList *sl, String StrIn)
{
// Only looks for SQL SERVER(S) on the network.
RETCODE rc1, rc2;
bool SUCCESS = true;
// Get initial response, discover available servers
lstrcpy(szConnStrIn, StrIn.c_str());
rc1 = SQLBrowseConnect(hdbc, szConnStrIn, SQL_NTS, szConnStrOut,
sizeof(szConnStrOut),
&cbConnStrOut);
if (rc1 == SQL_SUCCESS || rc1 == SQL_NEED_DATA) {
i=1;
while ((rc2 = SQLGetDiagRec(SQL_HANDLE_DBC, hdbc, i, SqlState,
&NativeError,
Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA)
{
DisplayError_(SqlState, NativeError, Msg, MsgLen);
i++;
}
ProcessReturnString(szConnStrOut, sl);
}
else
SUCCESS = false;
return SUCCESS;
}
// ------------------------
String StrIn is set to "DRIVER={SQL Server};"
The variable szConnStrOut returns "SERVER=Server={(loc, NOAH\\MSSMLBIZ};...
when parsed for the servers the local server becomes (loc
Any help or direction would be very good.
thanks
daryl
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads