Article View: borland.public.cppbuilder.database.ado
Article #4228Re: Using TCP/IP protocol with MSSQL and ADO
From: Jens Nielsen
Date: Tue, 26 Feb 2002 16:40
Date: Tue, 26 Feb 2002 16:40
69 lines
3088 bytes
3088 bytes
Thanks for the reply.
I actually found the answer i another newsgroup.
This link provides good information about connection strings for ODBC and
ADO on serveral database systems.
http://www.able-consulting.com\ADO_Conn.htm
Jens
"Bill Rampey" <brampey@flsg.follett.com> wrote in message
news:3c7ba6a3$1_1@dnews...
> 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:
<3c7bbaa6$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!attmtf!ip.att.net!usc.edu!howland.erols.net!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3c7b7019_2@dnews> <3c7ba6a3$1_1@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 08:47:41 PST From: "Jens Nielsen" <JN@CRMT.DK> Newsgroups: borland.public.cppbuilder.database.ado References: <3c7b7019_2@dnews> <3c7ba6a3$1_1@dnews> Subject: Re: Using TCP/IP protocol with MSSQL and ADO Date: Tue, 26 Feb 2002 17:40:24 +0100 Lines: 71 Organization: CRM Technologies X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 217.157.226.16 Message-ID: <3c7bbaa6$1_1@dnews> X-Trace: dnews 1014741670 217.157.226.16 (26 Feb 2002 08:41:10 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!attmtf!ip.att.net!usc.edu!howland.erols.net!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!dnews