Article View: borland.public.cppbuilder.database.ado
Article #680Re: TADOQuery Stupid Question ParamByName vs SQL Text
From: Heinz Ketchup
Date: Fri, 24 Feb 2006 17:15
Date: Fri, 24 Feb 2006 17:15
50 lines
2600 bytes
2600 bytes
"Arnie" <none> wrote: > >Hi Heinz, > >My guess is that the problem is in: > >WHERE (tme >= '1138778100' AND tme <= '1138863600') AND (tagName >= 'Tag1') ORDER BY tme > >Those numbers don't look like any valid date/time format to me. >I'd suggest using parameters as you did with the design-time SQL >statement. In fact, I suggest you always use parameters for best >efficiency and to make sure you don't have to escape quote >characters out of literal strings. > >- Arnie Hi Arnie, Thanks for the Feedback! Greatly Appreciated. I think it'd be nice to pass in parameters to, but with a changing "WHERE" clause, it seems the TDataModule I have would get muddled. I did manage to track down, though not completely understand why one process works and not the other. More or less, it's an educated guess. It came down to the way the DB fields were structured. The DB Table has fields as strings, and a VIEW, I "SELECT" from refers to this DB Table. Strangely, in the view it does Date Mathematics on the string fields (which is a date in string format), and the final result is it returns a date (which is correct based on the math). The numbers are a calculated date in UTC seconds. That was what was killing the Query. So I type casted the "View" to return the Date as a String, and it works fine now. I guess it's a DB thing where it is flexible with field type conversions with in the database software, and doesn't do the same when it's coming from my code, as it must be a defined type. Well... at least it works now. Thanks, Heinz
Technical Details
Message-ID:
<43ff4d29$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43fb7f38$1@newsgroups.borland.com> <43fc7b6a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,6c24e68800b2d06 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: Re: TADOQuery Stupid Question ParamByName vs SQL Text Newsgroups: borland.public.cppbuilder.database.ado X-User-Info: 146.131.120.2 References: <43fb7f38$1@newsgroups.borland.com> <43fc7b6a$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <43ff4d29$1@newsgroups.borland.com> Date: 24 Feb 2006 10:15:05 -0700 X-Trace: newsgroups.borland.com 1140804905 207.105.83.66 (24 Feb 2006 10:15:05 -0700) Lines: 54 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail