Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter query

Status
Not open for further replies.

Cagliostro

Programmer
Sep 13, 2000
4,226
GB
Hi,
How can I create a parameter in a query?
In SQL Server is possible to write
declare @xxx int
set @xxx=10
select SomeThing from SomeWhere
where SomeOrOtherThing = @xxx John Fill
1c.bmp


ivfmd@mail.md
 
In query designer you just need to type a prompt enclosed in brackets in the criteria field of the column SomeOrOtherThing.

For example: [Enter the value of SomeOrOtherThing]

Upon execution of the query, an input box with the prompt will be displayed. The user can fill in the input box, hit enter and the query will execute using the criteria entered. Terry
 
No,
I need to call a query through ODBClike folowing:

include<sql.h>
#include<string>
using namespace std;
int main()
{
string strSql(&quot;declare @xxx int\nset @xxx = &quot;);
int x = 10;
str+=string(x);
str+=&quot;\nselect SomeThing from SomeWhere
where SomeOrOtherThing = @xxx&quot;;
....
SQLPrepare(...strSql.c_str()....);
....
}
There I can't use Access DialogBoxes. It is a C++ program what use an ODBC interface. John Fill
1c.bmp


ivfmd@mail.md
 
 
I do not want an ActiveX or an ODBC sample in C++, Java or other languages. For me it is already familiar. I want a parametrized query like I wrote is good for SQL Server if it is possible. If is impossible, I want know what is impossible. I know what to do if is impossible. What I want is the easiest way. John Fill
1c.bmp


ivfmd@mail.md
 
Queries like you wrote in SQL Server are not always possible in Access. SQL queries can be step-by-step procedures while Access queries cannot be procedures.

I only recommended the articles above because they show ODBC and ADO use of Access &quot;parameterized queries.&quot; I thought you could extend those examples into your C++ code.

It appears that I may be totally misunderstanding what you are attempting to do. I certainly apologize if I've wasted your time. Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top