CODE TO INSERT DATA USING STORED PROCDEURE
con = new SqlConnection(strcon);
con.Open();
cmd = new SqlCommand("register",con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(("@FirstName //WHAT SHOULD BE WRITTEN HERE
cmd.ExecuteNonQuery();
con.Close();
hi iam isnserting data into the sql database by using the stored procdure i created stored procdure successfully in sql server but
how to write the code above is the code that i tried i think we have to write in a format lin cmd.parameters.add(----); etc
please giveme the code to insert data using the stored procdure
my stored procdure is like this
CREATE PROCEDURE dbo.register
(
@FirstName varchar(50),
@LastName varchar(50),
@DateofBirth datetime,
@gender varchar(50) ,
@Education varchar(50),
@Address varchar(50) ,
@games varchar(50) ,
@hobbies varchar(50) ,
@emailid varchar(50) ,
@mobile varchar(50) ,
@username varchar(50) ,
@password varchar(50)
)
as
insert into Registration(FirstName,LastName,DateofBirth,gender,Education,Address,games,hobbies,emailid,mobile,username,password) values(@FirstName,@LastName,@DateofBirth,@gender,@Education,@Address,@games,@hobbies,@emailid,@mobile,@username,@password);