2010-06-14 5 views
0

Lorsque j'utilise le code suivant, je reçois cette erreur:.!
« erreur OleDbException Syntaxe dans l'instruction INSERT INTOC# problème avec ADO

plz help me

{ 
        // add the new username 
        System.Data.OleDb.OleDbCommandBuilder cb; 
        cb = new System.Data.OleDb.OleDbCommandBuilder(da); 


        DataRow dRow = cPD_DatabaseDataSet.Tables["users_table"].NewRow(); 

        dRow[0] = this.textBox_add_user.Text ; 
        dRow[1] = this.textBox_password.Text ; 

        cPD_DatabaseDataSet.Tables["users_table"].Rows.Add(dRow); //add new record 

        cb.GetUpdateCommand(); 
        cb.GetInsertCommand(); 
        //save new recode into the Access file 
        da.Update(cPD_DatabaseDataSet, "users_table"); 


        //clear textboxes 
        this.textBox_add_user.Text = ""; 
        this.textBox_password.Text = ""; 
        this.textBox_re_password.Text = ""; 

       } 
       catch (System.Data.OleDb.OleDbException exp) 
       { 
        //close the connection 

        this.con.Close(); 

        MessageBox.Show(exp.ToString()); 
       }` 
+0

Veuillez inclure la commande INSERT dans le code. – Humberto

Répondre

0

Si vous pouvez obtenir le chaîne qui représente l'instruction d'insertion, il devrait être assez facile de vous dire quel est le problème