abdelwaheb ammar

abdelwaheb ammar

  • 1.3k
  • 393
  • 118.6k

parameterized query with Access database

Feb 26 2016 6:40 PM
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
 
  1. class connexionGS  
  2.     {  
  3.         private OleDbConnection con = new OleDbConnection(Properties.Settings.Default.connectGS);  
  4.         private OleDbConnection getconnexion()  
  5.         {  
  6.             //con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=../../gestion reglement.accdb;Persist Security Info=False;");  
  7.             //con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.GetData("DataDirectory") + "/gestion reglement.mdb;");  
  8.             string constr = Properties.Settings.Default.connectGS;  
  9.             con=new OleDbConnection(constr);  
  10.             return con;  
  11.         }  
  12.    
  13.         public static void ExcuteNonQuery(string requete)  
  14.         {  
  15.             connexionGS connect = new connexionGS();  
  16.             OleDbConnection con = connect.getconnexion();  
  17.             con.Open();  
  18.             OleDbCommand cmd = new OleDbCommand(requete, con);  
  19.             cmd.ExecuteNonQuery();  
  20.             cmd.Dispose();  
  21.             con.Close();  
  22.         }  
  23.    
  24.     }  
 and then I add another class named product :
 
  1. public class Produit  
  2.    {  
  3.       public void AjouterProduit()  
  4.       {  
  5.          throw new NotImplementedException();  
  6.       }  
  7.    
  8.       public void ModifierProduit()  
  9.       {  
  10.          throw new NotImplementedException();  
  11.       }  
  12.    
  13.       public void SupprimerProduit()  
  14.       {  
  15.          throw new NotImplementedException();  
  16.       }  
  17.    
  18.       public String referenceP;  
  19.       public String libelle;  
  20.       public DateTime dateProduction;  
  21.       public Double prix;  
  22.       public int qte;  
  23.    
  24.    }  
 
knowing that I use oledb.
can i find an example that uses the parameter query with the database access and OleDbConnection?
 
 

Answers (2)