Article View: borland.public.cppbuilder.database.ado
Article #892ADO ParamByName I just don't get.
From: bmkiss
Date: Thu, 24 Feb 2005 17:53
Date: Thu, 24 Feb 2005 17:53
94 lines
2969 bytes
2969 bytes
I'm trying to convert from BDE to ADO. I don't know much about ADO so I
hope this isn't completely stupid. The chunk of code below doesn't work. I
get the following error stepping thru the code.
---------------------------
Debugger Exception Notification
---------------------------
Project COBB.exe raised exception class EOleException with message
'Application uses a value of the wrong type for the current operation'.
Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
ADOqSuggestions->Close();
ADOqSuggestions->SQL->Clear();
ADOqSuggestions->SQL->Add("Insert into Suggestions
values(:name,:phone,:email,:sub,");
ADOqSuggestions->SQL->Add(":sug,:compname,:time,:status,:ccr)");
ADOqSuggestions->Parameters->ParamByName("name")->Value = lmdeName->Text;
ADOqSuggestions->Parameters->ParamByName("phone")->Value =
lmdePhone->Text;
ADOqSuggestions->Parameters->ParamByName("email")->Value =
lmdeEmail->Text;
ADOqSuggestions->Parameters->ParamByName("sub")->Value =
lmdeSubject->Text;
ADOqSuggestions->Parameters->ParamByName("sug")->Value =
lmdmSuggestion->Text;
ADOqSuggestions->Parameters->ParamByName("compname")->Value =
MessageString;
ADOqSuggestions->Parameters->ParamByName("time")->Value = Now();
ADOqSuggestions->Parameters->ParamByName("status")->Value = "Open";
ADOqSuggestions->Parameters->ParamByName("ccr")->Value = '0';
ADOqSuggestions->Prepared = true;
ADOqSuggestions->ExecSQL();
ADOqSuggestions->Prepared = false;
Parameters as defined in SQL
Name = varchar(27)
Phone = varchar(27)
Email = varchar(40)
Sub = varchar(60)
Sug = text(16)
Compname = varchar(50)
Time = datetime
Status = varchar(25)
Ccr = varchar(10)
What am I missing? What am I doing wrong? Is there a better way of doing
this?
Thanks in advance.
Technical Details
Message-ID:
<421e146a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,a417b8aa4c547b63,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "bmkiss" <bmkiss67@cablespeed.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: ADO ParamByName I just don't get. Date: Thu, 24 Feb 2005 12:53:00 -0500 Lines: 97 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 68.48.16.112 Message-ID: <421e146a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109267562 68.48.16.112 (24 Feb 2005 09:52:42 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!nntp.giganews.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.nntp.be!propagator2-sterling.newsfeeds.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail