Article View: borland.public.cppbuilder.database.ado
Article #674TADOQuery Stupid Question ParamByName vs SQL Text
From: Heinz Ketchup
Date: Tue, 21 Feb 2006 19:59
Date: Tue, 21 Feb 2006 19:59
59 lines
2715 bytes
2715 bytes
I Apologize if this is a stupid question, but I haven't had
any success thus far on resolving this issue.
I have a TADO query setup at design time with a SQL Statement
and Parameters.
When I assign the Parameters based on the design time query
everything works peachy clean.
// Perform SQL Operations
QueryPointer->Close();
QueryPointer->Parameters->ParamByName("StartDateTimeString")->Value = StartingDateTime;
QueryPointer->Parameters->ParamByName("EndDateTimeString")->Value = EndingDateTime;
QueryPointer->Parameters->ParamByName("TagNameQuery")->Value = TagNameString;
QueryPointer->Open();
Do stuff with the dataset.
The SQL Statement is
SELECT tagName, timeString, curVal, offset
FROM DBA.vwAccumMinute
WHERE (tme >= :StartDateTimeString) AND (tme <= :EndDateTimeString) AND (tagName = :TagNameQuery)
ORDER BY tme
On the Down Side:
When I manually create the SQL Text:
The error I get is a type mismatch.
QueryPointer->Close();
QueryPointer->SQL->Clear();
QueryPointer->SQL->Text = SQLStatementString;
QueryPointer->Open();
...
SQLStatementString =
"SELECT tagName, timeString, curVal, offset
FROM DBA.vwAccumMinute
WHERE (tme >= '1138778100' AND tme <= '1138863600') AND (tagName = 'Tag1') ORDER BY tme
On the analysis of both SQL Statement's, they appear identical.
The process I use is just a little different.
The reason I am doing this is to see if I can use the same Query with a "modified" sql statement.
i.e. SELECT tagName, timeString, curVal
blah blah blah...
WHERE (tagName = 'This' or tagName = 'That' or tagName = 'Meep')
Any assistance is HIGHLY appreciated.
PS: Code is in the correct order and compiles fine.
I'm just trying to get across my problem, so please don't take
the represented code line by line.
Thank you v. much,
Heinz
Technical Details
Message-ID:
<43fb7f38$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.volia.net!newsfeed.utanet.at!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,6c24e68800b2d06,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Heinz Ketchup" <heinz_like_the_ketchup@h0tmail.n0spam.c0m.n0spam> Sender: "Heinz Ketchup" <heinz_like_the_ketchup@h0tmail.n0spam.c0m.n0spam> Reply-To: "Heinz Ketchup" <heinz_like_the_ketchup@h0tmail.n0spam.c0m.n0spam> Subject: TADOQuery Stupid Question ParamByName vs SQL Text Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 146.131.120.2 NNTP-Posting-Host: 207.105.83.66 Message-ID: <43fb7f38$1@newsgroups.borland.com> Date: 21 Feb 2006 12:59:36 -0700 X-Trace: newsgroups.borland.com 1140555576 207.105.83.66 (21 Feb 2006 12:59:36 -0700) Lines: 59 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.volia.net!newsfeed.utanet.at!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail