Article View: borland.public.cppbuilder.nativeapi
Article #2184ODBC API Problem, looking for SQL Servers - local, remote OK
From: 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
Technical Details
Message-ID:
<462dd175@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,33d5772d581fc943,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Daryl" <devaccount@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: ODBC API Problem, looking for SQL Servers - local, remote OK Date: Tue, 24 Apr 2007 19:44:16 +1000 Lines: 49 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6000.16386 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16386 NNTP-Posting-Host: 202.63.48.162 Message-ID: <462dd175@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1177407861 202.63.48.162 (24 Apr 2007 02:44:21 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail