Procedure or function 'SubmitRecord' expects parameter '@name', which was not supplied.
What I have tried:
try
{
cnn.Open();
SqlCommand cmd=new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd = new SqlCommand("SubmitRecord", cnn);
cmd.Parameters.AddWithValue("@name",txtname.Text);
cmd.Parameters.AddWithValue("@about",txtabout.Text);
cmd.Parameters.AddWithValue("@address", txtaddress.Text);
cmd.Parameters.AddWithValue("@email",txtemail.Text);
cmd.Parameters.AddWithValue("@mobile", txtcno.Text);
cmd.Parameters.AddWithValue("@refname", txtrefname.Text);
cmd.Parameters.AddWithValue("@areyou",DropDownList1.SelectedValue.ToString());
cmd.Parameters.AddWithValue("@interest",interests);
cmd.Parameters.AddWithValue("@anyother",txtanyother.Text);
cmd.Parameters.AddWithValue("@quote",quote);
cmd.Parameters.AddWithValue("@sharenews",sharenews);
cmd.Parameters.AddWithValue("@remark", txtremark.Text);
cmd.Parameters.AddWithValue("@pass",pass);
cmd.Parameters.AddWithValue("@typeofsub", sub);
cmd.ExecuteNonQuery();
stored procedure:
ALTER PROCEDURE [dbo].[SubmitRecord]
(
@name varchar(50),
@about nvarchar(MAX),
@address varchar(200),
@email varchar(50) ,
@mobile varchar(20),
@refname varchar(50),
@areyou varchar(50),
@interest varchar(MAX),
@anyother varchar(MAX),
@quote varchar(50),
@sharenews varchar(50),
@remark varchar(MAX),
@pass varchar(50),
@typeofsub varchar(50)
)
AS
INSERT INTO [Businessnews].[dbo].[tbl_register]
([name]
,[about]
,[address]
,[email]
,[mobile]
,[refname]
,[areyou]
,[interest]
,[anyother]
,[quote]
,[sharenews]
,[remark]
,[pass]
,[regdate]
,[typeofsub])
VALUES(@name,@about,@address,@email,@mobile,@refname,@areyou,@interest,@anyother,@quote,@sharenews,@remark,
@pass,
GETDATE(),
@typeofsub
)