Article View: borland.public.cppbuilder.database.ado
Article #4512Re: ADO MSAccess SQL Query Problem
From: David Barnes
Date: Wed, 12 Dec 2001 22:35
Date: Wed, 12 Dec 2001 22:35
37 lines
2206 bytes
2206 bytes
I am fairly new to the ADO side so take this with some caution, it is merely an idea. I am guessing from your string that Variable1 and Variable2 are values that will/are assigned. I think you solutions might be in Params. ex: "Select * From TableName Where Field1 = :Variable1 And Field2 = :Variable2" ADOQuery1->Parameters->ParamByName( "Variable1" )->AsString = "Hello"; ADOQuery1->Parameters->ParamByName( "Variable2" )->AsString = "World"; etc... Notice the : in the select statement, that is a must for the params to work. Hope this helps. David Barnes Michael Mouer wrote: > Check the following please: > > "Select * From TableName Where Field1 = Variable1 And Field2 = Variable2" > > Error Message is "Project X.exe raised exception class EOleException with Message 'Parameter Variable1 has no default value'. Process stopped. Use Step or Run to continue." > > When I substitute a literal, 123, for variable1 and literal, 456, for variable2 it works correctly. > > Variable1 is a long integer and variable is a single float. > > I searched the Builder and MSAccess help files to no avail. > > Any help or suggestions greatly appreciated. > > Michael Mouer > >
Technical Details
Message-ID:
<3C17DB99.7040105@kalos-inc.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3c17ba51$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,994d42e49a41be55 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-12-12 15:01:38 PST Message-ID: <3C17DB99.7040105@kalos-inc.com> Date: Wed, 12 Dec 2001 16:35:05 -0600 From: David Barnes <david@kalos-inc.com> User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: ADO MSAccess SQL Query Problem References: <3c17ba51$1_1@dnews> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 65.69.231.139 X-Trace: dnews 1008196524 65.69.231.139 (12 Dec 2001 14:35:24 -0800) Lines: 38 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!newsfeed.mesh.ad.jp!osa.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews