hi frnz i have a table name Employee Master...it have a total 8 columns..
I want to insert a data of new employee in this table...I have created one form named addemp.aspx... for that.
i have written code for that..
bt when i m going to submit this from i get error...at runtime..
Exception Details: System.Data.Sql Client.SqlExcep tion: Incorrect syntax near 'Master'.
so What is my mistakes..plz tell me how to insert This data..
I want to insert a data of new employee in this table...I have created one form named addemp.aspx... for that.
i have written code for that..
Code:
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Mydata.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd;
string str;
protected void btnSignUp_Click(object sender, EventArgs e)
{
str = "insert into Employee Master values"+"('"+ txtempname + "','" + txtempcode + "','" + txtdepartment + "','" + txtcontactno + "','" + txtusername + "','" + txtpassword + "','" + txtemail + "')";
cmd = new SqlCommand(str, con);
if (con.State == ConnectionState.Closed)
con.Open();
cmd.ExecuteNonQuery();
}
Exception Details: System.Data.Sql Client.SqlExcep tion: Incorrect syntax near 'Master'.
so What is my mistakes..plz tell me how to insert This data..
Comment