Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
parameterized query with Access database
abdelwaheb ammar
Feb 26 2016 6:40 PM
319
Reply
Good evening, I research a lot on the net but I find not how used the parameter query to a database Access.in fact I create a connectionString and then I add this connection class
class
connexionGS
{
private
OleDbConnection con =
new
OleDbConnection(Properties.Settings.Default.connectGS);
private
OleDbConnection getconnexion()
{
//con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=../../gestion reglement.accdb;Persist Security Info=False;");
//con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.GetData("DataDirectory") + "/gestion reglement.mdb;");
string
constr = Properties.Settings.Default.connectGS;
con=
new
OleDbConnection(constr);
return
con;
}
public
static
void
ExcuteNonQuery(
string
requete)
{
connexionGS connect =
new
connexionGS();
OleDbConnection con = connect.getconnexion();
con.Open();
OleDbCommand cmd =
new
OleDbCommand(requete, con);
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
}
and then I add another class named product :
public
class
Produit
{
public
void
AjouterProduit()
{
throw
new
NotImplementedException();
}
public
void
ModifierProduit()
{
throw
new
NotImplementedException();
}
public
void
SupprimerProduit()
{
throw
new
NotImplementedException();
}
public
String referenceP;
public
String libelle;
public
DateTime dateProduction;
public
Double prix;
public
int
qte;
}
knowing that I use oledb.
can i find an example that uses the parameter query with the database access and OleDbConnection?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
selecting multiple rows in datagridview by checkbox
convert fro datagridview to excel without for loop