all groups > dotnet datatools > april 2008 >
You're in the

dotnet datatools

group:

Running stored procedure - input parameter cannot be converted


Running stored procedure - input parameter cannot be converted rbrowning1958
3/23/2008 7:37:17 PM
dotnet datatools:
Hello,

VS2005 - SQL Server 2005.

Running an SP from the server explorer window. The SP accepts two
parameters:

@s varchar(128) = NULL,
@b bit = 0

I cannot seem to set the bit value. I receive the error "Input
parameter cannot be converted". Ideas anyone? Can run it from SQL
Server without problem.

Thanks

Re: Running stored procedure - input parameter cannot be converted Accessed
3/26/2008 5:42:59 PM
[quoted text, click to view]

Not so much of an answer as another complaint -
I have been using the debug process for SQL server procedures until 26
March 2008, and now the same procedures have started to exhibit the
same error you mention.
I found that it is the BIT type variables that complain now, after
working fine for two weeks

When I convert them to TINYINT, they work!

A fellow programmer seemed to remember an existing fault in Vis Studio
regarding BIT types, and this seems to be the problem.

maybe that will help you also

Cheers

Ray

Re: Running stored procedure - input parameter cannot be converted Charles Calvert
3/31/2008 9:37:05 PM
On Sun, 23 Mar 2008 19:37:17 -0700 (PDT), rbrowning1958
<RBrowning1958@gmail.com> wrote in
<8b215e6b-020c-4ce3-bff2-473784a8bd67@s50g2000hsb.googlegroups.com>:

[quoted text, click to view]

What is the code that you're using to set the bit? I'm using 2003, so
I think the classes are slightly different, but if you use an instance
of System.Data.SqlClient.SqlCommand and add a parameter like this:

cmd.Parameters.Add(
new System.Data.SqlClient.SqlParameter(
"@b",
System.Data.SqlDbType.Bit,
1
)
);

it should work.
--
Charles Calvert | Software Design/Development
Celtic Wolf, Inc. | Project Management
http://www.celticwolf.com/ | Technical Writing
Re: Running stored procedure - input parameter cannot be converted rbrowning1958
4/6/2008 4:56:58 AM
[quoted text, click to view]

Hello,

I can set it in code - that's not the problem. It's running it from
within the Visual Studio IDE which is the problem. It runs OK from
within SQL Server management studio, however.

Best

AddThis Social Bookmark Button