1
In my procedure
I have the following variables:
@Codigo VARCHAR(MAX),@cont as int, @DataPago as VARCHAR(10)
Via C# application I am passing the values as follows:
y1.Parameters.Add("@Codigo", SqlDbType.VarChar).Value = "2,4";
y1.Parameters.Add("@cont", SqlDbType.Int).Value = 1;
y1.Parameters.Add("@DataPago", SqlDbType.VarChar, 10).Value = "20/05/2015";
The problem is I’m getting the following error:
Conversion failed when Converting the varchar value '2,4' to data type int.
However, when I put the direct value in my past, it works, as below:
WHERE P.RELATORIO in (2,4)
Tried to do this?
y1.Parameters.Add("@Codigo", SqlDbType.VarChar).Value = "2.4";
If it’s not this, put the query and details plus the problem. It’s weird what you want, maybe for lack of complete information.– Maniero
You’re passing the code on
IN
ofWHERE
?– Laerte
I edited the question
– Rafael Barbosa