C# problem with ADO

Posted by ahmed on Stack Overflow See other posts from Stack Overflow or by ahmed
Published on 2010-06-14T03:21:55Z Indexed on 2010/06/14 3:32 UTC
Read the original article Hit count: 301

Filed under:

When i use the following code, i get this error :
"OleDbexception Syntax error in INSERT INTO statement.

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());
                }`

© Stack Overflow or respective owner

Related posts about c#