public void AddnewRecord(string title_id, string title, string type, string pub_id, string price, string advance, string royalty, string ytd_sales, string notes, string pubdate)
{
sn = new SqlConnection("Data Source=VITSERVER;Initial Catalog=pubs;User ID=sa;Password=vit");
string sqlstat = "INSERT into titles" + "(title_id,title,type,pub_id,price,advance,royalty,ytd_sales,notes,pubdate)" +
" VALUES(@title_id,@title,@type,@pub_id,@advance,@royalty,@ytd_sales,@notes,@pubdate)";
try
{
sn.Open();
cmd = new SqlCommand(sqlstat, sn);
cmd.Parameters.AddWithValue("@title_id", title_id);
cmd.Parameters.AddWithValue("@title", title);
cmd.Parameters.AddWithValue("@type", type);
cmd.Parameters.AddWithValue("@pub_id", pub_id);
cmd.Parameters.AddWithValue("@price", price);
cmd.Parameters.AddWithValue("@advance", advance);
cmd.Parameters.AddWithValue("@royalty", royalty);
cmd.Parameters.AddWithValue("@ytd_sales", ytd_sales);
cmd.Parameters.AddWithValue("@notes", notes);
cmd.Parameters.AddWithValue("@pub_id", pub_id);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch(System.Data.SqlClient.SqlException ex)
{
string msg="INSERT error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
sn.Close();
}
}
while debugging i am getting error as
Error 1 No overload for method