Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
<pre lang="c#"> this._commandCollection[1].CommandText = "dbo.COMPANY_CHANGE_PASS";
            this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure;
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PASSWORD", global::System.Data.SqlDbType.NVarChar, 100, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
            this._commandCollection[2].Connection = this.Connection;


What I have tried:

<pre lang="c#"> this._commandCollection[1].CommandText = "dbo.COMPANY_CHANGE_PASS";
            this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure;
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PASSWORD", global::System.Data.SqlDbType.NVarChar, 100, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
            this._commandCollection[2].Connection = this.Connection;
Posted
Comments
j snooze 22-Aug-17 17:50pm    
Have you verified that your parameter list matches the parameter list of the stored procedure and in the correct order? some code seems to be missing as I don't see where the statement is actually being executed, it looks like you are trying to create a bunch of SQL commands into a command collection and then you must be looping through them to execute?
sommr0 22-Aug-17 17:55pm    
ALTER PROCEDURE [dbo].[COMPANY_CHANGE_PASS]
-- Add the parameters for the stored procedure here
@Password NVARCHAR(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
UPDATE COMPANYMST SET Password=@Password
Patrice T 22-Aug-17 19:34pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.
sommr0 22-Aug-17 17:55pm    
This is a procedure but procedure work properly ...
j snooze 22-Aug-17 17:59pm    
did you try adding the password parameter as the first parameter?...and actually the only parameter...I also don't see the return value variable being returned anywhere.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900