hello can somebody check my query cause i'm having a hard time working on it., i need to insert data on my database when i process it tells syntax error in Insert into statement pls. help thnx
try
{
OleDbCommand cmdSave = new OleDbCommand();
cmdSave.Connection = cls_DB.cn;
cmdSave.CommandText = "insert into tblMember(Std_ID,Last_N,First_N,Mid_N,Level,Section) values (?,?,?,?,?,?)";
cmdSave.Transaction = Tran;
cmdSave.Parameters.Add("@Std_ID", OleDbType.VarChar).Value = this.txtStud_ID.Text;
cmdSave.Parameters.Add("@Last_N", OleDbType.VarChar).Value = this.txtLast_N.Text;
cmdSave.Parameters.Add("@First_N", OleDbType.VarChar).Value = this.txtFirst_N.Text;
cmdSave.Parameters.Add("@Mid_N", OleDbType.VarChar).Value = this.txtMid_N.Text;
cmdSave.Parameters.Add("@Level", OleDbType.VarChar).Value = this.cmbLevel.Text;
cmdSave.Parameters.Add("@Section", OleDbType.VarChar).Value = this.txtSection.Text;
cmdSave.ExecuteNonQuery();
cmdSave.Parameters.Clear();
cmdSave.Dispose();
Tran.Commit();
cls_Function.setMessageBox("Data Edited Successfuly", 1);
}
catch (Exception exp)
{
Tran.Rollback();
cls_Function.setCreateError(exp.Message);
}
finally
{
if (this.cls_DB.cn != null) this.cls_DB.cn.Close();
}