Pass DropDownList Selected Item Value to MS Access database Query in ASP.Net

Last Reply on Jul 15, 2013 03:26 AM By RkHirpara

Posted on Jul 15, 2013 02:39 AM

in my asp.net+vb+access database web. in a page ia m using a query to count.. the following code works fine

qstr1 = "select count(*) from Pers where coy='tata' and OutDetails IS NULL and firm='" + DropDownList1.Text + "'"

but the next one is not working (in the below one i want dropdownlist value (names) contains in outdetails field

 qstr8 = "select count(*) from pers where OutDetails like '" + DropDownList1.Text + "'"

Posted on Jul 15, 2013 03:26 AM

Hi baijuep,

Please update your query like

 qstr8 = "select count(*) from pers where OutDetails like '%" + DropDownList1.Text + "%'"

Thanks and Regards,

Rk_Hirpara