Article View: borland.public.cppbuilder.database.ado
Article #1120Specifying field's data type in select statement
From: Benjamin Pratt
Date: Fri, 07 Jan 2005 05:20
Date: Fri, 07 Jan 2005 05:20
37 lines
2279 bytes
2279 bytes
I am having a problem where I have an ADO query. The SELECT portion of the query is: SELECT ID, true AS Achieved, DateAchieved, Prompt Here, I am creating a calculated field where the value is always true. The problem is when the result set is returned, the 'Achieved' data type is ShortInt. I need it to be Boolean. I have tried simply changing the definition in the form to TBooleanField, but at run time I get an error stating the field types do not match. Is there some way I can explicitly define the datatype in the select statement? Something like: SELECT ID, BOOLEAN(true) AS Achieved, DateAchieved, Prompt I am using BCB6 & Jet4.0. The entire query is below. SELECT ID, true AS Achieved, DateAchieved, Prompt FROM ACHIEVEMENTS, BENCHMARKS WHERE ID = BenchmarkID AND LanguageID = :LanguageID AND CategoryID=:CategoryID AND LevelID=:LevelID AND ID In (SELECT BenchmarkID FROM BENCHMARK_GRADES WHERE Grade = :Grade) AND StudentID = :StudentID UNION SELECT ID, false AS Achieved, Null AS DateAchieved, Prompt FROM BENCHMARKS WHERE ID NOT IN (SELECT BenchmarkID FROM ACHIEVEMENTS WHERE StudentID = :StudentID) AND LanguageID=:LanguageID AND CategoryID=:CategoryID AND LevelID=:LevelID AND ID In (SELECT BenchmarkID FROM BENCHMARK_GRADES WHERE Grade = :Grade) ORDER BY ID
Technical Details
Message-ID:
<41de19d4$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!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,25798ef5199d0276,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Benjamin Pratt" <benjamin.pratt.getridofthis@verizon.net> Newsgroups: borland.public.cppbuilder.database.ado Subject: Specifying field's data type in select statement Date: Thu, 6 Jan 2005 21:20:55 -0800 Lines: 39 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 NNTP-Posting-Host: 66.245.228.69 Message-ID: <41de19d4$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1105074644 66.245.228.69 (6 Jan 2005 21:10:44 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail