hi
i want to store data in table in my database in sqlserver from microsoft visual studio, but i can not, because give error Incorrect syntax near 'valuse' and it point to co.ExecuteNonQu ery(); please help to me.
my code:
i want to store data in table in my database in sqlserver from microsoft visual studio, but i can not, because give error Incorrect syntax near 'valuse' and it point to co.ExecuteNonQu ery(); please help to me.
my code:
Code:
private void btn_add_person_Click(object sender, EventArgs e)
{
SqlConnection cmd = new SqlConnection(@"data source = (local);integrated security = sspi;initial catalog = db_library");
string input = "@ insert into person(name,family,father_name,id,email,job,birth_certificate,superscription,phone_number,national_issue) valuse (" + "'" + txt_name.Text + "','" + txt_family.Text + "','" + txt_father_name.Text + "'," + Convert.ToInt32(txt_id.Text) + ",'" + txt_email.Text + "','" + txt_job.Text + "'," + Convert.ToInt32(txt_birth_certificate.Text) + ",'" + txt_superscription.Text + "'," + Convert.ToInt32(txt_phone_number.Text) + "," + Convert.ToInt32(txt_national_issue.Text) + ")";
SqlCommand co = new SqlCommand(input,cmd);
cmd.Open();
co.ExecuteNonQuery();
cmd.Close();
}
Comment