Click here to Skip to main content
15,918,041 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have design an access query which seem like this:
SELECT Replace(names,'lion','kiss') AS Expr1<br />
FROM table1;

the two values that is lion and kiss, which are temporary, now i want these to be two variables, so that i can pass value to it from c#.
how to call this query from c# using oledb, and pass it two values.
I am using access 2007 and c#.
Thanks for your help :)
Posted
Updated 2-Mar-11 3:29am
v2

1 solution

Look at this article here; Scroll down to the section on SQL Parameters

Beginners guide to accessing SQL Server through C#[^]

Or for an access example;
How to link to an Access Database in a C# Application[^]
 
Share this answer
 
v3
Comments
bachasafyan 2-Mar-11 9:30am    
this is for sql server and i am using access. Thanks
DaveAuld 2-Mar-11 9:40am    
Look at this article then; http://www.codeproject.com/KB/database/linkAccessInCSharp.aspx it surprisingly uses parameters as well!
bachasafyan 2-Mar-11 9:55am    
this is about oledataadapter and i am using oledb :)
DaveAuld 2-Mar-11 11:01am    
I think you need to go review the classes and objects and do some research, i think you will find that the objects and members of the various data access classes are very similarly structured.........

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