7
Answers

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

kritika

kritika

15y
5.8k
1

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)