Article View: borland.public.cppbuilder.database.ado
Article #2688arguments of the wrong type error
From: George Pestana
Date: Mon, 07 Apr 2003 19:27
Date: Mon, 07 Apr 2003 19:27
220 lines
7550 bytes
7550 bytes
one of our clients is using an ADOQuery and ADOConnection VCL component
within BCB 6 to access a Pervasive SQL (i.e. Btrieve) database using our
Pervasive OLEDB provider. He is getting the EOleException "arguments are of
the wrong type, are out of acceptable range, or are in conflict with one
another" error when he executes it within BCB ; but then he clicks OK and
receives the correct output anyways. When he runs his program outside of
the IDE, he doesn't get the error. When he switches to using the MSDASQL.1
provider, he does not see the error, but in that case he sees a different
error in the ADOConnection->Errors list which does not produce an exception.
I found a description of a similar bug on borland's bug page for delphi 5
(which mentions that the bug was also found in BCB 5) and the bug page
indicates that the bug was fixed in delphi 5, but does not mention if the
bug was fixed in BCB 5 or 6. I am referring to this link:
http://info.borland.com/devsupport/delphi/fixes/delphi501/database.html
- search for the phrase "Reference Number: 76476".
My question is : is this in fact the same bug that we are seeing, and if
not, has anyone seen something similar which may be able to point us in the
right direction to fix the problem?
specifics of the test program which demonstrates the problem follow :
A) main form looks like this :
object Form1: TForm1
Left = 192
Top = 107
Width = 508
Height = 219
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ListBox1: TListBox
Left = 64
Top = 24
Width = 409
Height = 97
ItemHeight = 13
TabOrder = 0
end
object Button1: TButton
Left = 256
Top = 136
Width = 73
Height = 33
Caption = 'Go'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 96
Top = 136
Width = 73
Height = 33
Caption = 'Use OLEDB'
TabOrder = 2
OnClick = Button2Click
end
object Button3: TButton
Left = 176
Top = 136
Width = 73
Height = 33
Caption = 'Use ODBC'
TabOrder = 3
OnClick = Button3Click
end
end
TForm1 *Form1;
//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::Button1Click(TObject *Sender)
{
DMod->ListFile();
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::Button2Click(TObject *Sender)
{
DMod->ADOConnection1->Close();
DMod->ADOConnection1->ConnectionString = "Provider=PervasiveOLEDB.8.10;Data
Source=PVideoDB;Persist Security Info=False";
DMod->ADOConnection1->Connected = true;
ListBox1->Items->Add("Using PervasiveOLEDB for Connection:");
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::Button3Click(TObject *Sender)
{
DMod->ADOConnection1->Close();
DMod->ADOConnection1->ConnectionString = "Provider=MSDASQL.1;Persist
Security Info=False;Data Source=PVideoDB";
DMod->ADOConnection1->Connected = true;
ListBox1->Items->Add("Using ODBC for Connection:");
}
//--------------------------------------------------------------------------
-
B) data module (DMod) looks like this :
object DMod: TDMod
OldCreateOrder = False
Left = 192
Top = 107
Height = 194
Width = 283
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=PervasiveOLEDB.8.10;Data Source=PVideoDB;Persist Securi' +
'ty Info=False'
Mode = cmReadWrite
Provider = 'PervasiveOLEDB.8.10'
Left = 32
Top = 32
end
object ADOQuery1: TADOQuery
Connection = ADOConnection1
CursorType = ctOpenForwardOnly
Parameters = <
item
Name = 'key'
DataType = ftString
Size = -1
Value = Null
end>
SQL.Strings = (
'')
Left = 136
Top = 32
end
end
TDMod *DMod;
//--------------------------------------------------------------------------
-
__fastcall TDMod::TDMod(TComponent* Owner)
: TDataModule(Owner)
{
}
//--------------------------------------------------------------------------
-
int TDMod::ListFile()
{
AnsiString S, work;
S = "select * from Categories where Description = :key";
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(S);
int nCount;
ADOConnection1->Errors->Get_Count(nCount);
if (nCount != 0)
{
for(int i = 0; i < nCount; i++)
{
WideString err;
_di_Error MyErr;
ADOConnection1->Errors->Get_Item(Variant(i),MyErr);
MyErr->Get_Description(err);
Form1->ListBox1->Items->Add(AnsiString(err));
}
}
ADOQuery1->Prepared = true;
ADOQuery1->Parameters->ParamByName("key")->Value = "Documentary";
ADOQuery1->Open();
while ( !ADOQuery1->Eof ) {
work = ADOQuery1->FieldByName("Description")->AsString;
work += " ";
work += ADOQuery1->FieldByName("CategoryID")->AsString;
Form1->ListBox1->Items->Add(work);
ADOQuery1->Next();
}
return 0;
}
C) to see the error, the user does this
1) compiles and runs the program within the BCB6 IDE
2) logs unto the adoconnection (with blank username and password)
3) clicks "use oledb" button
4) logs onto the adoconnection (with blank username and password)
5) sees "Using PervasiveOLEDB for Connection:" in the list box
6) clicks the GO button
7) sees the Debugger Exception Notification error message within the IDE :
"project test1.exe raised exception class EOleException with message
'Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another'. process stopped, use step or run to continue."
8) clicks OK. presses F9 to continue running
9) sees the correct output in the listbox
10) clicks "use odbc" button
11) logs onto the adoconnection (with blank username and password)
12) sees "Using ODBC for Connection" in the list box
13) clicks the GO button
14) sees the following in the list box : "[Microsoft][ODBC Driver Manager]
Driver's SQLSetConnectAttr failed" followed by the correct output in the
listbox.
Any ideas?
Technical Details
Message-ID:
<3e91d173$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,9d986c571f841433,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-04-07 12:32:52 PST Reply-To: "George Pestana" <gpestana@nospam.pervasive.com> From: "George Pestana" <gpestana@nospam.pervasive.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: arguments of the wrong type error Date: Mon, 7 Apr 2003 14:27:05 -0500 Lines: 222 Organization: Pervasive Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 66.45.103.246 Message-ID: <3e91d173$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1049743731 66.45.103.246 (7 Apr 2003 12:28:51 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail