G
Guest
Hello
I'm trying to use a parameter to specify values for an IN clause, if I do this, everything works fine
sqlSelectCommand1.CommandText = "SELECT [ID] FROM [TableName] WHERE ([ColumnName] IN (@ColumnValueList)) ORDER BY [ID]"
sqlSelectCommand1.Connection = this.sqlConnection1
sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ColumnValueList", System.Data.SqlDbType.Int))
sqlSelectCommand1.Parameters["@ColumnValueList"].Value = "10"
However, if I replace that last line with the following (i.e. more than one value) I get "Input String was not in a correct format.
sqlSelectCommand1.Parameters["@ColumnValueList"].Value = "10, 20"
How can I do this
Regards
Dav
I'm trying to use a parameter to specify values for an IN clause, if I do this, everything works fine
sqlSelectCommand1.CommandText = "SELECT [ID] FROM [TableName] WHERE ([ColumnName] IN (@ColumnValueList)) ORDER BY [ID]"
sqlSelectCommand1.Connection = this.sqlConnection1
sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ColumnValueList", System.Data.SqlDbType.Int))
sqlSelectCommand1.Parameters["@ColumnValueList"].Value = "10"
However, if I replace that last line with the following (i.e. more than one value) I get "Input String was not in a correct format.
sqlSelectCommand1.Parameters["@ColumnValueList"].Value = "10, 20"
How can I do this
Regards
Dav