I'm trying to create a Windows form that inserts data into my database when I type into it and click submit. It works for short things, but when I tried to type some longer sentences, it says this:
And here's the code:
private void SubmitButton_Click(object sender, EventArgs e)
{
con.Open();
cmd = new SqlCommand("INSERT INTO Jokes VALUES('" + EnterJoke.Text + "', '" + EnterAnswer.Text + "')", con);
cmd.ExecuteNonQuery();
MessageBox.Show(" Data Has Been Saved In Database ");
con.Close();
}
I get the error on this line:
cmd.ExecuteNonQuery();