When I use below code I get "Parameter count does not match Parameter Value
count".

Anyone know why I get this?

SqlParameter[] sqlParameters = new SqlParameter[2];

sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
sqlParameters[0].Value = ntUserName;

sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
sqlParameters[1].Value = 0;

DataSet dsEmployee = null;
dsEmployee =
SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
"GetEmployee", sqlParameters);

Re: SqlParameter Class by Miha

Miha
Thu May 04 14:39:20 CDT 2006

Perhaps SqlHelper.ExecuteDataset expects more parameters. Or less.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"C" <C@discussions.microsoft.com> wrote in message
news:8AC18673-560C-48CF-A1C6-8029A3D03097@microsoft.com...
> When I use below code I get "Parameter count does not match Parameter
> Value
> count".
>
> Anyone know why I get this?
>
> SqlParameter[] sqlParameters = new SqlParameter[2];
>
> sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
> sqlParameters[0].Value = ntUserName;
>
> sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
> sqlParameters[1].Value = 0;
>
> DataSet dsEmployee = null;
> dsEmployee =
> SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
> "GetEmployee", sqlParameters);
>



Re: SqlParameter Class by MSDN

MSDN
Thu May 04 15:37:09 CDT 2006

forgot if sqlParameter[x] is zero based or not

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:uJAeyJ7bGHA.4932@TK2MSFTNGP03.phx.gbl...
> Perhaps SqlHelper.ExecuteDataset expects more parameters. Or less.
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "C" <C@discussions.microsoft.com> wrote in message
> news:8AC18673-560C-48CF-A1C6-8029A3D03097@microsoft.com...
>> When I use below code I get "Parameter count does not match Parameter
>> Value
>> count".
>>
>> Anyone know why I get this?
>>
>> SqlParameter[] sqlParameters = new SqlParameter[2];
>>
>> sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
>> sqlParameters[0].Value = ntUserName;
>>
>> sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
>> sqlParameters[1].Value = 0;
>>
>> DataSet dsEmployee = null;
>> dsEmployee =
>> SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
>> "GetEmployee", sqlParameters);
>>
>
>



Re: SqlParameter Class by MSDN

MSDN
Thu May 04 15:49:33 CDT 2006

Forgot if SqlParameter[] sqlParameters = new SqlParameter[x]; is zero
based or not??

where x = 1 or 2 ??

SqlParameter[] sqlParameters = new SqlParameter[1];

Also it should tell you if the number of Parameters are correct for the
Stored procedure "GetEmployee". you are not getting that error.


SA

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:uJAeyJ7bGHA.4932@TK2MSFTNGP03.phx.gbl...
> Perhaps SqlHelper.ExecuteDataset expects more parameters. Or less.
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "C" <C@discussions.microsoft.com> wrote in message
> news:8AC18673-560C-48CF-A1C6-8029A3D03097@microsoft.com...
>> When I use below code I get "Parameter count does not match Parameter
>> Value
>> count".
>>
>> Anyone know why I get this?
>>
>> SqlParameter[] sqlParameters = new SqlParameter[2];
>>
>> sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
>> sqlParameters[0].Value = ntUserName;
>>
>> sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
>> sqlParameters[1].Value = 0;
>>
>> DataSet dsEmployee = null;
>> dsEmployee =
>> SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
>> "GetEmployee", sqlParameters);
>>
>
>



Re: SqlParameter Class by Miha

Miha
Fri May 05 04:05:17 CDT 2006

It is zero based.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"MSDN" <sql_agentman@hotmail.com> wrote in message
news:uYAbFq7bGHA.3344@TK2MSFTNGP03.phx.gbl...
> forgot if sqlParameter[x] is zero based or not
>
> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message
> news:uJAeyJ7bGHA.4932@TK2MSFTNGP03.phx.gbl...
>> Perhaps SqlHelper.ExecuteDataset expects more parameters. Or less.
>>
>> --
>> Miha Markic [MVP C#]
>> RightHand .NET consulting & development www.rthand.com
>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>>
>> "C" <C@discussions.microsoft.com> wrote in message
>> news:8AC18673-560C-48CF-A1C6-8029A3D03097@microsoft.com...
>>> When I use below code I get "Parameter count does not match Parameter
>>> Value
>>> count".
>>>
>>> Anyone know why I get this?
>>>
>>> SqlParameter[] sqlParameters = new SqlParameter[2];
>>>
>>> sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
>>> sqlParameters[0].Value = ntUserName;
>>>
>>> sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
>>> sqlParameters[1].Value = 0;
>>>
>>> DataSet dsEmployee = null;
>>> dsEmployee =
>>> SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
>>> "GetEmployee", sqlParameters);
>>>
>>
>>
>
>



Re: SqlParameter Class by Cowboy

Cowboy
Fri May 05 07:15:23 CDT 2006

WHere are you hooking the parameters up to the command object?

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"C" <C@discussions.microsoft.com> wrote in message
news:8AC18673-560C-48CF-A1C6-8029A3D03097@microsoft.com...
> When I use below code I get "Parameter count does not match Parameter
> Value
> count".
>
> Anyone know why I get this?
>
> SqlParameter[] sqlParameters = new SqlParameter[2];
>
> sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
> sqlParameters[0].Value = ntUserName;
>
> sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
> sqlParameters[1].Value = 0;
>
> DataSet dsEmployee = null;
> dsEmployee =
> SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
> "GetEmployee", sqlParameters);
>



Re: SqlParameter Class by Miha

Miha
Fri May 05 08:46:58 CDT 2006

I was assuming in SqlHelper.ExecuteDataset method call in the last line.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> wrote in
message news:eoM7V2DcGHA.3484@TK2MSFTNGP03.phx.gbl...
> WHere are you hooking the parameters up to the command object?
>
> --
> Gregory A. Beamer
>
> *************************************************
> Think Outside the Box!
> *************************************************
> "C" <C@discussions.microsoft.com> wrote in message
> news:8AC18673-560C-48CF-A1C6-8029A3D03097@microsoft.com...
>> When I use below code I get "Parameter count does not match Parameter
>> Value
>> count".
>>
>> Anyone know why I get this?
>>
>> SqlParameter[] sqlParameters = new SqlParameter[2];
>>
>> sqlParameters[0] = new SqlParameter("@NTUserName", SqlDbType.VarChar);
>> sqlParameters[0].Value = ntUserName;
>>
>> sqlParameters[1] = new SqlParameter("@FlgActive", SqlDbType.Bit);
>> sqlParameters[1].Value = 0;
>>
>> DataSet dsEmployee = null;
>> dsEmployee =
>> SqlHelper.ExecuteDataset(Configuration.GetAppConfigSetting("SQLConnect"),
>> "GetEmployee", sqlParameters);
>>
>
>