Article View: borland.public.cppbuilder.database.ado
Article #4227Re: Using TCP/IP protocol with MSSQL and ADO
From: Bill Rampey
Date: Tue, 26 Feb 2002 15:15
Date: Tue, 26 Feb 2002 15:15
52 lines
2739 bytes
2739 bytes
Hi Jens,
I had to figure this out by wadeing through these groups. Here is a snipet
of code that should help you out. Read the comments below for your answer.
_connection = new TADOConnection(Application->MainForm);
assertSTOP(_connection!=NULL);
try
{
String cs;
// This connection string specifies the "type"
// of connection that should be used to talk with
// the SQL Server. "Network Library=DBMSSOCN" means
// use TCP/IP as the protocol. The default if nothing
// is specified appears to be "Named Pipes" which won't
// work on Windows 9x machines without requireing.
// a user account to exist on the server.
// Other options are available but TCP/IP should work
// fine.
cs = "Provider=SQLOLEDB.1;Network Library=DBMSSOCN;Password=";
cs += _SQLPassword;
cs += ";User ID=";
cs += _SQLUser;
cs += ";Initial Catalog=";
cs += database;
cs += ";Data Source=";
if(_liveData)
cs += getLiveServerName();
else
cs += getTestServerName();
_connection->ConnectionString = cs;
_connection->KeepConnection = true;
_connection->LoginPrompt = false;
_connection->Mode = cmReadWrite;
_connection->IsolationLevel = ilCursorStability;
_connection->Connected = true;
established = true;
}
catch(...)
{
delete _connection;
_connection = NULL;
SHOW_ERROR("Exception thrown activateing ADO connection.");
}
-Bill
Technical Details
Message-ID:
<3c7ba6a3$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!129.250.35.146!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3c7b7019_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,b9f782f1852df4ac X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-02-26 07:27:54 PST Reply-To: "Bill Rampey" <brampey@flsg.follett.com> From: "Bill Rampey" <brampey@flsg.follett.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3c7b7019_2@dnews> Subject: Re: Using TCP/IP protocol with MSSQL and ADO Date: Tue, 26 Feb 2002 09:15:48 -0600 Lines: 55 Organization: Follett Library and School Group X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 NNTP-Posting-Host: 208.241.70.159 Message-ID: <3c7ba6a3$1_1@dnews> X-Trace: dnews 1014736547 208.241.70.159 (26 Feb 2002 07:15:47 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!129.250.35.146!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews