RE: More ADOquery woes on D5

Louis Nardozi <[email protected]> Thu, 14 Aug 2003 22:19:06 -0500
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
Just curious,
Have you tried using

adoquery1.parameters.parambyname['received'].Value:=received; ?

if that doesn't work either, you might be stuck with manipulating the ParameterObject directly, or at least
clearing the sql, closing and repoening the query.

The equivalent of 

adoquery1.parameters.parambyname['received'].AsString:=received;

is not supported, because it only supports variants.

Sorry I can't be of more help.

Regards,
Louis

>Message: 16
>   Date: Thu, 14 Aug 2003 17:00:33 +0100
>   From: Angus Macdonald <[email protected]>
>Subject: RE: More ADOquery woes on D5
>
>Just bumping this one in case it's been missed in all the shouting 
>
>-----Original Message-----
>From: Angus Macdonald [mailto:[email protected]]
>Sent: 14 August 2003 10:30
>To: [email protected]
>Subject: [Delphi] More ADOquery woes on D5
>
>
>I'm sure I'm missing something extremely obvious here. Maybe posting it will
>jog my memory.
>
>I'm converting another old (perfectly working) BDE project to ADO and the
>migration from TQuery to TADOQuery is throwing up a few funnies as usual.
>Here are the salient points:
>
>const
>  sqladdentry1:string='insert into dbo.referrals
>values(convert(datetime,:received,103),
>:fromname,:subject,0,:body,:attach1id,:attach1name,:attach2id,:attach2name,:
>attach3id,:attach3name,:attach4id,:attach4name,:attach5id,:attach5name,:from
>addr,:fromtext,0,:office,0,0)';
>
>...later on...
>
>   adoquery1.sql.clear;
>   adoquery1.sql.add(sqladdentry1);
>   adoquery1.parameters.paramvalues['received']:=received;
>   adoquery1.parameters.paramvalues['fromname']:=fromname;
>   adoquery1.parameters.paramvalues['fromaddr']:=fromaddr;
>   adoquery1.parameters.paramvalues['fromtext']:=fromtext;
>   adoquery1.parameters.paramvalues['subject']:=subject;
>   adoquery1.parameters.paramvalues['body']:=bodytextstr;
>   adoquery1.parameters.paramvalues['attach1id']:=attachid[1];
>   adoquery1.parameters.paramvalues['attach1name']:=attachname[1];
>   adoquery1.parameters.paramvalues['attach2id']:=attachid[2];
>   adoquery1.parameters.paramvalues['attach2name']:=attachname[2];
>   adoquery1.parameters.paramvalues['attach3id']:=attachid[3];
>   adoquery1.parameters.paramvalues['attach3name']:=attachname[3];
>   adoquery1.parameters.paramvalues['attach4id']:=attachid[4];
>   adoquery1.parameters.paramvalues['attach4name']:=attachname[4];
>   adoquery1.parameters.paramvalues['attach5id']:=attachid[5];
>   adoquery1.parameters.paramvalues['attach5name']:=attachname[5];
>   adoquery1.parameters.paramvalues['office']:=refoffice;
>   adoquery1.parameters.paramvalues['received']:=received;
>   adoquery1.execsql;
>
>All variables are strings and all corresponding fields in the MSSQL database
>are Varchar. For some reason I get an exception as soon as I hit the
>adoquery1.parameters.paramvalues lines "Application uses a value of the
>wrong type for the current operation". I thought it might be to do with the
>convert operation in my SQL so I shuffled the paramvalues statements around
>and the exception always happens on the first one. The same query and
>equivalent TQuery statements were perfectly happy via BDE.
>
>I've updated my MDAC to 2.8 and installed the ADOExpress update from Borland
>for Delphi 5 Enterprise.
>
>This is a service application so debugging is not too easy, although I may
>convert it back to a standard app if I don't make any progess.
>
>All help gratefully received.
>Angus
>
>
>
>  
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/