0

This is how I get the value of the selected column in a gridview in my code behind(C#)

str += "'" + MyGridview.DataKeys[gvrow.RowIndex].Value.ToString() + "',";

This is the value of str

str='7','101','235','456'

My output here is correct. My problem is i got error when i pass this value on stored procedure parameter.

This is the way I pass this value to my stored procedure;

: some other parameter here
cmD.Parameters.AddWithValue("@Rec",str);

And on my stored procedure this is how i get this

Declare @Rec AS NVARCHAR(MAX)

Select col1,col2 where Record_no in ('' + @Rec + '') 

My error is

Conversion failed when converting the nvarchar value 
odlan yer
  • 721
  • 1
  • 7
  • 15

0 Answers0