Article View: borland.public.cppbuilder.database.ado
Article #5796ADO try catch problems
From: Bob Piskac
Date: Fri, 16 Feb 2001 22:24
Date: Fri, 16 Feb 2001 22:24
38 lines
2151 bytes
2151 bytes
I keep on getting an exception error before the catch handler. I am
putting the wrong password in the dialog box on purpose. What am I doing
wrong?
ls_adoString = "Provider=SQLOLEDB.1;Persist Security Info=False;";
ls_adoString = ls_adoString + "User ID =" + sle_userid->Text + ";";
ls_adoString = ls_adoString + "Data Source =" + sle_server->Text + ";";
ls_adoString = ls_adoString + "Password =" + sle_password->Text;
DataModule1->ADOConnection1->ConnectionString = ls_adoString;
try{
// Exception happens after the open call.
DataModule1->ADOConnection1->Open();
DataModule1->ADOQuery1->SQL->Clear();
DataModule1->ADOQuery1->SQL->Add("sp_databases");
DataModule1->ADOQuery1->Open();
DataModule1->DataSource1->DataSet->First();
while (DataModule1->DataSource1->DataSet->Eof == false){
ListBox1->Items->Add(DataModule1->DataSource1->DataSet->FieldByName("DAT
ABASE_NAME")->AsString );
DataModule1->DataSource1->DataSet->Next();
}
DataModule1->ADOQuery1->Close();
DataModule1->ADOConnection1->Close();
}
catch(EOleException &VCLException){
Application->MessageBox(VCLException.Message.c_str(),"Error",0L);
};
Technical Details
Message-ID:
<20010216.22245002@waldo.idi-net.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!skynet.be!newsfeed1.uni2.dk!newssuck.uni2.dk!bornews.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,5189a1dcc469f432,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-02-16 14:32:08 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeeds.belnet.be!news.belnet.be!skynet.be!newsfeed1.uni2.dk!newssuck.uni2.dk!bornews.borland.com!not-for-mail From: Bob Piskac <bob@pbsoftware.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: ADO try catch problems Date: Fri, 16 Feb 2001 22:24:50 GMT Organization: Another Netscape Collabra Server User Lines: 38 Message-ID: <20010216.22245002@waldo.idi-net.com> NNTP-Posting-Host: workstation4.dqe-it.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-Newsreader: Mozilla/3.0 (compatible; StarOffice/5.2;Win32)