mydb thedb = new mydb();
            MyGlobal oapp = new MyGlobal();

            //define the reader
            System.Data.OleDb.OleDbDataReader theReader = null;

            //defining sql
            string _sql = "SELECT * FROM searchtest WHERE ID = " +  _ddsearch;
            string _sqlupdate = "";

            //execute the reader
            theReader  = thedb.SQLExecute_Reader(_sql);

this code is try to grab the value from _ddsearch variable
if the value is number it works
but if it is string, theReader return null

this is the problem string _sql = "SELECT * FROM searchtest WHERE ID = " + _ddsearch; the code above is for number

how do you make ID = " + _ddsearch; to get variable value as string

I try to put another qutation mark but it is still wrong

8 Years
Discussion Span
Last Post by LizR

it probably needs quote marks round it too or it will try and think its a column name


the problem is that theReader return string and the variable return int(number)
which is i have to format it to string to make the reader read

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.