I'm having trouble with my select command. The scenario is when i'm putting many value in my variable I got nothing but if i put only one value in variable it is working.
All I want is to run this script:
SELECT *
FROM gsm00 a
INNER JOIN gsd00 b ON a.idnum=b.idnum WHERE b.idnum IN ('0001','0002')
Here's my sample code:
string val= "0001" - this is working
//string val= "0001,0002"
- this is not working
query = "SELECT * FROM gsm00 a INNER JOIN gsd00 b ON a.idnum=b.idnum WHERE b.idnum IN (@searchKey)";
MySqlDataAdapter dataAdapter = new MySqlDataAdapter(query, dbconfig.conn);
dataAdapter.SelectCommand.Parameters.AddWithValue("@searchKey", val);
dataAdapter.Fill(dataTable);
dataAdapter.Dispose();