exception in stored procedure
-
Procedure or Function 'SubmitRecord1' expects parameter '@ID', which was not supplied.this is the error i am getting while insert into data base using stored procedure can any body help me plz...
NRHSR wrote:
Procedure or Function 'SubmitRecord1' expects parameter '@ID', which was not supplied
How can an error message be more clear? :)
Navaneeth How to use google | Ask smart questions
-
Procedure or Function 'SubmitRecord1' expects parameter '@ID', which was not supplied.this is the error i am getting while insert into data base using stored procedure can any body help me plz...
I recommend a job at McDonalds. It seems that computing is too hard for you. The error means what it says.
Christian Graus Driven to the arms of OSX by Vista.
-
Procedure or Function 'SubmitRecord1' expects parameter '@ID', which was not supplied.this is the error i am getting while insert into data base using stored procedure can any body help me plz...
-
I recommend a job at McDonalds. It seems that computing is too hard for you. The error means what it says.
Christian Graus Driven to the arms of OSX by Vista.
-
"What do you mean, 'I din't give you any fries?' Nah - too complex.
___________________________________________ .\\axxx (That's an 'M')
Procedure or Function 'SubmitRecord1' expects parameter '@ID', which was not supplied. this is the exception i am getting when i run.and my code is protected void Submit1_ServerClick(object sender, EventArgs e) { string constr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd = new SqlCommand("SubmitRecord1", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter sp1 = new SqlParameter("@ID",SqlDbType.NVarChar,10); sp1.Value = TextBox1.Text; SqlParameter sp2 = new SqlParameter("@Password",SqlDbType.NVarChar,50); sp2.Value = TextBox2.Text; SqlParameter sp3 = new SqlParameter("@ConfirmPassword",SqlDbType.NVarChar,50); sp3.Value = TextBox3.Text; SqlParameter sp4 = new SqlParameter("@EmailID",SqlDbType.NVarChar,200); sp4.Value = TextBox4.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); //cmd.ExecuteNonQuery(); } my stored procedure is CREATE PROCEDURE dbo.SubmitRecord1 ( @ID varchar(10), @Password varchar(50), @ConfirmPassword varchar(50), @EmailID varchar(200) ) AS INSERT INTO login1(ID,Password,ConfirmPassword,EmailID)VALUES(@ID,@Password,@ConfirmPassword,@EmailID) RETURN i am passing parameter ... then also its throwing exception...... can any body help me ...
-
Procedure or Function 'SubmitRecord1' expects parameter '@ID', which was not supplied. this is the exception i am getting when i run.and my code is protected void Submit1_ServerClick(object sender, EventArgs e) { string constr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd = new SqlCommand("SubmitRecord1", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter sp1 = new SqlParameter("@ID",SqlDbType.NVarChar,10); sp1.Value = TextBox1.Text; SqlParameter sp2 = new SqlParameter("@Password",SqlDbType.NVarChar,50); sp2.Value = TextBox2.Text; SqlParameter sp3 = new SqlParameter("@ConfirmPassword",SqlDbType.NVarChar,50); sp3.Value = TextBox3.Text; SqlParameter sp4 = new SqlParameter("@EmailID",SqlDbType.NVarChar,200); sp4.Value = TextBox4.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); //cmd.ExecuteNonQuery(); } my stored procedure is CREATE PROCEDURE dbo.SubmitRecord1 ( @ID varchar(10), @Password varchar(50), @ConfirmPassword varchar(50), @EmailID varchar(200) ) AS INSERT INTO login1(ID,Password,ConfirmPassword,EmailID)VALUES(@ID,@Password,@ConfirmPassword,@EmailID) RETURN i am passing parameter ... then also its throwing exception...... can any body help me ...
You're not adding any of the parameters to the command object something like cmd.Parameters.Add(sp1); (Look it up - I don't have an example in front of me - but that's the issue here - upir cmd object doesn't know about the parameters.
___________________________________________ .\\axxx (That's an 'M')
-
You're not adding any of the parameters to the command object something like cmd.Parameters.Add(sp1); (Look it up - I don't have an example in front of me - but that's the issue here - upir cmd object doesn't know about the parameters.
___________________________________________ .\\axxx (That's an 'M')
protected void Submit1_ServerClick(object sender, EventArgs e) { string constr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd = new SqlCommand("SubmitRecord1", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.NVarChar,10).Value = TextBox1.Text; cmd.Parameters.Add("@Password", SqlDbType.NVarChar, 50).Value = TextBox2.Text; cmd.Parameters.Add("@ConfirmPassword", SqlDbType.NVarChar, 50).Value = TextBox3.Text; cmd.Parameters.Add("@EmailID", SqlDbType.NVarChar, 200).Value = TextBox4.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } stored procedure ALTER PROCEDURE dbo.SubmitRecord1 ( @ID varchar(10), @Password varchar(50), @ConfirmPassword varchar(50), @EmailID varchar(200) ) AS INSERT INTO login1(ID,Password,ConfirmPassword,EmailID)VALUES(@ID,@Password,@ConfirmPassword,@EmailID) RETURN this worked fine..... for reference u can see link Thanks any ways