RE: RE: More ADOquery woes on D5
Angus Macdonald <[email protected]> Fri, 15 Aug 2003 09:08:50 +0100
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <8281693F9EF2B140AA145EE9BE4675A60446BD93@nwwmail1.nww-tr.wales.nhs.uk> |
I tried using .value specifically but it didn't help. Thanks for the input though. I've recreated the service as a standard application for debugging purposes but I'm not any further on. The first parambyname still generates the error. If I redefine one of my MSSQL table fields from varchar(2048) to text the paramvalues all work but the execsql fails, presumably because I can't assign to a text field that way. -----Original Message----- From: Louis Nardozi [mailto:[email protected]] Sent: 15 August 2003 04:19 To: [email protected] Subject: [Delphi] RE: More ADOquery woes on D5 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,:fro m >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 ADVERTISEMENT <http://rd.yahoo.com/M=259538.3705203.4965331.1261774/D=egroupweb/S=17051153 62:HM/A=1712983/R=0/SIG=11u38u3s2/*http://hits.411web.com/cgi-bin/hit?page=1 374-105951838331032> click here <http://us.adserver.yahoo.com/l?M=259538.3705203.4965331.1261774/D=egroupmai l/S=:HM/A=1712983/rand=548140761> CodeCoffer - new Delphi code protection Tool! http://www.delphicollection.com/public/CodeCoffer.htm <http://www.delphicollection.com/public/CodeCoffer.htm> --------------------------------------------------------------- Unsubscribe:[email protected] List owner:[email protected] --------------------------------------------------------------- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . [Non-text portions of this message have been removed] ------------------------ 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 ---------------------------------------------------------------------~-> Delphi VCL Top Sites! http://www.sandbrooksoftware.com/TS/TS2/Components.shtml --------------------------------------------------------------- Unsubscribe:[email protected] List owner:[email protected] --------------------------------------------------------------- Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/