BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ODBC API Problem, looking for SQL Servers - local, remote OK

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Daryl
Guest





PostPosted: Tue Apr 24, 2007 2:44 pm    Post subject: ODBC API Problem, looking for SQL Servers - local, remote OK Reply with quote



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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.