Re: ADO exception with character combination inside string...
- From: Bo Berglund <bo.berglund@xxxxxxxxx>
- Date: Thu, 21 Sep 2006 00:39:59 +0200
On Wed, 20 Sep 2006 20:10:46 +0200, Bo Berglund
<bo.berglund@xxxxxxxxx> wrote:
The rule for database exception seems to be:
- string contains a " character
- Somewhere after the " there is also a : character
Further investigation shows this to be a problem inside the TADOQuery
component. We have used this extensively throughout our application so
we are now in a tight spot...
The test we did was to use the TADOconnection like this (with the
Northwind database):
procedure TForm1.btnModifyClick(Sender: TObject);
var
SQLString: string;
begin
try
SQLString := 'UPDATE Categories SET [Description] = ''' +
edData.Text + ''' WHERE CategoryID = 4';
connADO.ConnectionString := 'Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=Northwind;Data Source=POLARIS';
connADO.Open;
connADO.Execute(SQLString); <== This always works fine.
qryADO.SQL.Clear;
qryADO.SQL.Add(SQLString);
qryADO.ExecSQL; <== This fails for the condition above
connADO.Close;
except
on E: Exception do
MessageDlg('Error:'#13 + E.Message, mtError, [mbOK],0);
end;
end;
The exception message when the error occurs is this:
"Parameter object is improperly defined. Inconsistent or incomplete
information was provided"
Notice that the exception *only* occurs if the edData.Text string
contains somewhere first a " char and later a : char.
In all other cases the text will be stored in the database!
Please help....
.
- Follow-Ups:
- Re: ADO exception with character combination inside string...
- From: Brian Bushay TeamB
- Re: ADO exception with character combination inside string...
- From: Steve Zimmelman
- Re: ADO exception with character combination inside string...
- References:
- ADO exception with character combination inside string...
- From: Bo Berglund
- ADO exception with character combination inside string...
- Prev by Date: Re: Delphi 6 - ADO - MS SQL Server
- Next by Date: Re: ADO exception with character combination inside string...
- Previous by thread: ADO exception with character combination inside string...
- Next by thread: Re: ADO exception with character combination inside string...
- Index(es):
Relevant Pages
|