It dint work
private void Button1_Click(object sender, System.EventArgs e)
{
if(!Page.IsValid)
return;
mypanel.visible=false;
string fname=txtfname.Text;
string lname=txtlname.Text;
string uid=txtuser.Text;
string pass=txtpass.Text;
string dept=drpdep.SelectedItem.Value.ToString();
DateTime dt= DateTime.Today;
string ddt=dt.ToString();
string sqlin="insert into issueusers values('"+fname+"','"+lname+"','"+uid+"','"+pass+"',"+dept+",'"+ddt+"',0)";
SqlCommand cmd=new SqlCommand(sqlin,myutility.connection.getinstance());
cmd.ExecuteNonQuery();
Response.Write("<center>User Added</center>");
}
I see 2 things
1st this line of code only runs if the page does not validate, correct?
if(!Page.IsValid) instead of if(Page.IsValid)
2nd your SQL Insert statement is missing the names of the fields to insert the values into
string sqlin= "insert into issueusers values('"+fname+"','"+lname+"','"+uid+"','"+pass+"',"+dept+",'"+ddt+"',0)";
instead of
"insert into issueusers(fname,lname,uid,pass,dept,ddt,SomeOtherColumn) values('"+fname+"','"+lname+"','"+uid+"','"+pass+"',"+dept+",'"+ddt+"',0)";