A
Anderuu
Guest
so I'm trying to follow this tutorial
View: https://www.youtube.com/watch?v=TIAOr2S6-SY&feature=youtu.be
at 6:30-6:35
and for some reason I get this error? I'm pretty sure I have followed the tutorial step by step.
Can someone help me? I'm not sure what I'm meant to do.
private void btn_Add_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into table values('" + studentIDTextBox.Text + "','" + firstNameTextBox.Text + "','" + lastNameTextBox.Text + "','" + markTextBox.Text + "')";
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Record has been added to the Database.");
}
The error says System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'table'.'
Continue reading...
at 6:30-6:35
and for some reason I get this error? I'm pretty sure I have followed the tutorial step by step.
Can someone help me? I'm not sure what I'm meant to do.
private void btn_Add_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into table values('" + studentIDTextBox.Text + "','" + firstNameTextBox.Text + "','" + lastNameTextBox.Text + "','" + markTextBox.Text + "')";
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Record has been added to the Database.");
}
The error says System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'table'.'
Continue reading...