kritika

kritika

  • NA
  • 53
  • 0

problem in inserting data into database...!!!

Nov 4 2009 6:27 AM

hello....
 
as i had changed da code .....silly error is coming while inserting data into database....
here is my code ....
protected void btnregister_Click(object sender, EventArgs e)
{
if (Page.IsValid == true)
{

con.Open();

string userstr="INSERT INTO User(Code,UserPass,FirstName,LastName,BDate,BMonth,BYear) VALUES('" + txtuserid.Text + "','" + txtPassword.Text + "','" + txtFirstName.Text + "','" + txtLastName.Text + "','" + ddlDay.SelectedItem.ToString() + "','" + ddlMonth.SelectedItem.ToString() + "','" + ddlYear.SelectedItem.ToString() + "');";
cmd =
new OleDbCommand(userstr, con);
cmd.ExecuteNonQuery();

Response.Redirect(
"abc.aspx");
con.Close();

}
}
//here ddlDate,ddlMonth,ddlYear are 3 dropdownlist
it giving me error ..!!!
plz tell me where m going wrong?!
thanks in advance..

Answers (7)