RE: More ADOquery woes on D5
Angus Macdonald <[email protected]> Thu, 14 Aug 2003 11:33:08 +0100
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <8281693F9EF2B140AA145EE9BE4675A60446BCAB@nwwmail1.nww-tr.wales.nhs.uk> |
Curiouser and curiouser.... If I redefine my MSSQL table so that the "Body" field is of type Text rather than Varchar(2048), all the parameter assignments work but I receive a "Parameter is improperly defined" error when I execute the query. This seems very odd to me. -----Original Message----- From: Angus Macdonald [mailto:[email protected]] Sent: 14 August 2003 10:43 To: [email protected] Subject: RE: [Delphi] More ADOquery woes on D5 PS forget about the duplication of the assignment to the Received parameter. That was a typo on my part pasting my code in. -----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 ADVERTISEMENT < http://rd.yahoo.com/M=259538.3705203.4965331.1261774/D=egroupweb/S=17051153 <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 <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 <http://us.adserver.yahoo.com/l?M=259538.3705203.4965331.1261774/D=egroupmai > l/S=:HM/A=1712983/rand=798618295> CodeCoffer - new Delphi code protection Tool! http://www.delphicollection.com/public/CodeCoffer.htm <http://www.delphicollection.com/public/CodeCoffer.htm> < 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/ <http://docs.yahoo.com/info/terms/> > . [Non-text portions of this message have been removed] 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=796264987> 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] 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/