First of all, why are you putting @ on your string variables? @ is only used on SQL and not C# variables. You might want to change your code to this.
string pat = textBox1.Text.Trim();
string res = textBox2.Text.Trim();
if (pat.Length == 0 || res.Length == 0)
{
MessageBox.Show("Please enter something in the boxes.");
return;
}
MessageBox.Show(pat +" " + res);
SqlConnection cnn = new SqlConnection(OMSDB_Connection_String);
string command = "Insert INTO OTM_unsubscriptions (dbPatCnt, dbRespCnt, Email, PracticeID) " +
" VALUES (@valueOf_dbPatCnt,@valueOf_dbRespCnt, 1, 1)";
SqlCommand cmd = new SqlCommand(command, cnn);
command.Parameters.Add(new SqlParameter("@valueOf_dbPatCnt", pat));
command.Parameters.Add(new SqlParameter("@valueOf_dbRespCnt", res));
cnn.Open();
cmd.ExecuteNonQuery();
cnn.Close();
I simply removed the @ on the variables and fixed the code where you added your parameters. It seems your still a little confused with ADO.Net. I suggest you read more.