Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have used Access database in my application.

Now i want to write some query in the database, to retrieve data requested by my application.

- How to write parameterized query in the database, so that my application use it to retrieve required information ?.
- How to use parameterized query to fetch the information available in the database. ?

Please provide a sample if possible.
Posted
Comments
Sandeep Mewara 3-Aug-10 7:56am    
Reason for my vote of 1
Can be Googled easily!

Sigh, did you try Google?
Search for "parameterized query c#" and you will find everything you need. So simple.
 
Share this answer
 
Ok.. now i am able to create a parameterrised query...

SQL
SELECT *
FROM Emp
WHERE EmPId=["empId"];


Above procebure takes a EmP Id as a parameter input and it works fine.

Now can we use the above query for disfferent tables...

Can we pass a table name as a parameter??

How???
 
Share this answer
 
Comments
Sandeep Mewara 3-Aug-10 12:17pm    
If you havn't noticed then queries are just a string and strings can be formatted! So before executing the queries, you can format the query dynamically in your code... use the values or tables the way you want. As long as it's a valid query it is fine. Execute it.
What you asking is so basic, I suggest you step back and learn the basics of database programming. Grab a good book or read some online tutorials.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900