I used the following statement for a parameter.
.Parameters("@SearchValue").Value = TextBoxParentID.Text
for this query:
objSqlCommand.CommandText = "Select ID " & _
"From Parents " & _
"Where ID = @SearchValue"
ID is a SQL server numeric column but I get this error:
error converting nvarchar to numeric
Can you show me the coding needed fix this?
At this point you are trying to assign value which is of type string and the parameter is bound as string (nvarchar). You need to convert it at first.
This snippet also uses
AddWithValuemethod. I suggest you to use this approach.