I have made a windows application using C sharp, where I retrieve data from SQL database table.
I'm trying to retrieve data based on a query and for the where criteria I pass the value from the form checkedbox.
So i save the value of the checkedbox selected value to string variable Temp, the value of Temp for example is 'a','b','c'
So trying to pull all inv no where is either a, b or c
I'm trying to pass this value from Temp to the SQL query in the C # code like this
sql = "select CusNo, InvNo,amt from TestTbl where Invno ( in ( '"+Temp+"') ) ";
I do not get any rows returned. On the other hand If I trying giving the value directly it pulls the desired result
so when I try
sql = "select CusNo, InvNo,amt from TestTbl where Invno ( in ('a','b','c') ";
I get the results.
I will appreciate, if somebody can tell me the correct way to pass the string variable Temp value for the OR in the where clause.