i have multiple checkboxes on my form.i am trying to add them with stored procedure but it gives me Procedure or function konut_ekle has too many arguments specified
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);
SqlCommand cmd;
con.Open();
string cmdstr = "konut_ekle";
cmd = new SqlCommand(cmdstr, con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@kategori", TextBox1.Text);
cmd.Parameters.AddWithValue("@tip", TextBox2.Text);
cmd.Parameters.AddWithValue("@il", TextBox3.Text);
cmd.Parameters.AddWithValue("@ilce", TextBox4.Text);
cmd.Parameters.AddWithValue("@semt", TextBox5.Text);
cmd.Parameters.AddWithValue("@fiyat", TextBox7.Text);
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Selected)
{
cmd.Parameters.AddWithValue("@ozellik", CheckBoxList1.Items[i].Value);
}
}
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
}
ALTER PROCEDURE konut_ekle
@kategori varchar(50),
@tip varchar(50),
@il varchar(50),
@ilce varchar(50),
@semt varchar(50),
@fiyat varchar(50),
@ozellik varchar(50)
AS
SET NOCOUNT ON
insert into ilan (kategori,tip,il,ilce,semt)
values (@kategori,@tip,@il,@ilce,@semt)
declare @ilanid varchar(50)
set @ilanid = scope_identity()
insert into konut(ilanid,fiyat) values (@ilanid,@fiyat)
insert into ozellikler(ilanid,ozellik) values (@ilanid,@ozellik)
RETURN