hi all
store procedure
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[insertguestinfo]
@Guest_ID int,
@first_name nvarchar(50),
@Last_name nvarchar(50),
@Gender_ID int,
@Martial_ID int,
@Phone_number int,
@email_address nvarchar(50)
as
begin
insert into GuestInfo(Guest_ID,First_name,Last_name,Gender_ID,Martial_ID,Phone_number,Email_address)
values(@Guest_ID,@first_name,@Last_name,@Gender_id,@Martial_id,@Phone_number,@email_address)
END
public void add()
{
Guest_info gst_info=new Guest_info();
string ConString = @"Data Source=USER-PC\SQLEXPRESS;Initial Catalog=htm;Integrated Security=True";
SqlConnection con = new SqlConnection(ConString);
//string query = "Insert into GuestInfo(first name,last name,gender,martial status,phone number,email_address) values (" + Guest_id + ",'" + First_name+ "','" + Last_name + "','" + Gender_status + "','" + Martial_status + "','" + Phone_numb + "','" + Email_address + "')";
//SqlCommand cmd = new SqlCommand(query, con);
con.Open();
SqlCommand com = new SqlCommand("insertguestinfo", con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add(new SqlParameter("@guest_ID",gst_info.Guest_id));
com.Parameters.Add(new SqlParameter("@first_name", gst_info.First_name));
com.Parameters.Add(new SqlParameter("@Last_name", gst_info.Last_name));
com.Parameters.Add(new SqlParameter("@Gender_ID", gst_info.Gender_status));
com.Parameters.Add(new SqlParameter("@Martial_ID",gst_info.Martial_status));
com.Parameters.Add(new SqlParameter("@phone_number",gst_info.Phone_numb ));
com.Parameters.Add(new SqlParameter("@email_address",gst_info.Email_address ));
com.ExecuteNonQuery();
con.Close();
}
when i run the code the following error is occured
Procedure or function 'insertguestinfo' expects parameter '@first_name', which was not supplied.
where is th probelm :@