F
Fred
Hi,
When trying the following code :
[...]
oCmd = "SELECT MyField FROM MyTable WHERE MyID IN (@IDList)"
MyCommand = New SqlCommand(oCmd, oConn)
MyCommand.Parameters.Add(New SqlParameter("@IDList",
SqlDbType.NVarChar))
MyCommand.Parameters("@IDList").Value = "5611,1332"
[...]
I've got the following error :
Syntax error converting the nvarchar value '5611,1332' to a column of
data type int
MyID type is SqlDbType.Int
@IDList is a comma separated int values list (=> String). Is this type
correct or should I use another one ? Is there a particular syntax to
assign a parameter in that kind of query ?
Thanks
Fred
When trying the following code :
[...]
oCmd = "SELECT MyField FROM MyTable WHERE MyID IN (@IDList)"
MyCommand = New SqlCommand(oCmd, oConn)
MyCommand.Parameters.Add(New SqlParameter("@IDList",
SqlDbType.NVarChar))
MyCommand.Parameters("@IDList").Value = "5611,1332"
[...]
I've got the following error :
Syntax error converting the nvarchar value '5611,1332' to a column of
data type int
MyID type is SqlDbType.Int
@IDList is a comma separated int values list (=> String). Is this type
correct or should I use another one ? Is there a particular syntax to
assign a parameter in that kind of query ?
Thanks
Fred