CREATE PROCEDURE [dbo].[InsertRecord]
-- Add the parameters for the stored procedure here
@name varchar,
@gender varchar
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
insert into Test values('@name','@gender');
END
here is my code behind
string constr = ConfigurationManager.ConnectionStrings["JPConstr"].ConnectionString.ToString();
SqlConnection conn = new SqlConnection(constr);
conn.Open();
SqlCommand cmd = new SqlCommand("InsertRecord", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@name",TextBox1.Text);
cmd.Parameters.AddWithValue("@gender",TextBox2.Text);
cmd.ExecuteNonQuery();
Label2.Text = "Record inserted";
conn.Close();
record inserted in database like this
name=@name
gender=@gender
what is the problem with my code can anyone please tell