I am connecting to a database on MySQL to read certain data in a VB.NET Form. I am using MySQLCommand parameters to pass in my data, but have been unable to use the IN
query with multiple values in the parameters. Here is my query (with pointers to commands):
SELECT time, method FROM test1 WHERE custPin=@CUST AND dataID=@ID AND method IN (@CALLS)
There are upwards of two parameters I need to pass into @CALL
, which for examples sake will be test1, test2, test3
. These are stored in a list before being looped through and inserted into a string for the parameter, for example we will call testList
. Below is my MySQLCommand parameter:
dim testList As String = test1 & " " & test2 & " " & test3
mySQLCommand.Parameters.Add("@CALLS", MySqlDbType.String).Value = testList
I have tried to divide the testList
using ,
, '<SPACE>'
, and ''
, but no dice. When dividing it is putting in random \
into my string.
Is there a better way to use the IN
MySQL command with multiple values while using MySQL parameters as above?