ADOCommand and grave accent problem
From: David Fallas (fallasd_at_sysmexdelphic.com)
Date: 11/24/04
- Next message: Brian Bushay TeamB: "Re: how can i use identity column in the join logic,my solution"
- Previous message: Doug Szper: "Reading XLS file"
- Next in thread: Paolo Mancini: "Re: ADOCommand and grave accent problem"
- Reply: Paolo Mancini: "Re: ADOCommand and grave accent problem"
- Reply: David Fallas: "Re: ADOCommand and grave accent problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 24 Nov 2004 15:19:31 +1300
Win2k, MDAC 2.7, Delphi 6, Update 2, SQLServer 8.0.
The following causes an ADO exception (EADOError): 'Parameter object is
improperly defined. Inconsistent or incomplete information was provided'
...
sCols:= 'testchar,testnumber,testdate';
sVals:= QuotedStr('grave accent [`]') + ',10,' +
QuotedStr(FormatDateTime('yyyymmdd hh:nn:ss', Now));
sExecute:= 'INSERT INTO testtable(' + sCols + ')VALUES(' + sVals + ')';
ADOConnection:= TADOConnection.Create(nil);
ADOCommand:= TADOCommand.Create(nil);
try
ADOConnection.ConnectionString:= _ConnectionString;
ADOConnection.Open;
try
ADOCommand.Connection:= ADOConnection;
ADOCommand.CommandText:= sExecute;
ADOCommand.CommandType:= cmdText;
ADOCommand.ExecuteOptions:= [eoExecuteNoRecords];
ADOCommand.Execute;// <----- exception raised here
...
The following does not:
...
sCols:= 'testchar,testnumber,testdate';
sVals:= QuotedStr('grave accent [`]') + ',10,' +
QuotedStr(FormatDateTime('yyyymmdd hh:nn:ss', Now));
sExecute:= 'INSERT INTO testtable(' + sCols + ')VALUES(' + sVals + ')';
ADOConnection:= TADOConnection.Create(nil);
try
ADOConnection.ConnectionString:= _ConnectionString;
ADOConnection.Open;
try
ADOConnection.Execute(sExecute, cmdText);// <----- NO exception here
...
What is it about the grave accent character in ADOCommand?
I raised this issue a couple of years ago in these news groups, but I don't
recall any responses. It's still there, and still causing headaches. Any
ideas welcome.
BTW - table definition is as follows:
CREATE TABLE testtable(
testchar VARCHAR(40),
testnumber NUMERIC,
testdate DATETIME)
- Next message: Brian Bushay TeamB: "Re: how can i use identity column in the join logic,my solution"
- Previous message: Doug Szper: "Reading XLS file"
- Next in thread: Paolo Mancini: "Re: ADOCommand and grave accent problem"
- Reply: Paolo Mancini: "Re: ADOCommand and grave accent problem"
- Reply: David Fallas: "Re: ADOCommand and grave accent problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|