i have fields in my form like consultant name(owner) Event(listbox) start date end date
i have button:Export.After clicking on it,excel file is getting generated based on entered values.
queryStr = "SELECT distinct inq.inquiry_id,inq.source,inq.contact_name,inq.contact_name2,inq.email,inq.email1,inq.email2,inq.email3,inq.email4,inq.email5,inq.website,inq.website1,inq.contact_number,inq.telphone,inq.fax, inq.mobile, inq.product, inq.designation, inq.designation2, inq.address,inq.reason,inq.interested_in,inq.company,cat.category,country.country_name,inq.date,inq.inquiry_status,log.name " + appquery2 + " FROM crm_inquiry_perticipant inq " +
"INNER JOIN crm_login log ON inq.inquiry_owner=log.log_id " +
"INNER JOIN crm_category cat ON inq.cat_id=cat.cat_id INNER JOIN crm_countries country ON inq.country=country.country_id " +
"INNER JOIN crm_inquiry_event_assigned inq1 on inq.inquiry_id=inq1.inquiry_id " +
"INNER JOIN crm_event event on inq1.event_id=event.event_id " +
" WHERE " +
"(( " + owner + "=0) OR (inq.inquiry_owner=" + owner + ")) AND " +
" (('" + queryEventIDs + "'='') OR (inq1.event_id in(" + queryEventIDs + "))) AND " + //working for 1 event//'' quotes problem
"(('" + status + "'='--Select--') OR (inq.inquiry_status='" + status + "')) AND " +
" (('" + StartDateString + "'='') OR (inq.date BETWEEN '" + StartDateString + "' AND '" + EndDateString + "')) " +
appquery + prodquery + " Order By inq.inquiry_id desc ";
for this line:
" (('" + queryEventIDs + "'='') OR (inq1.event_id in(" + queryEventIDs + "))) AND " +
if i am adding consultant name and selecting multiple events(say 2 events),i am getting the excel file correctly. if i am entering consultant name and start date and end date,i am not getting the excel file.while debugging, i found datatable empty.
I slightly modified that line and executed:
" (('" + queryEventIDs + "'='') OR (inq1.event_id in('" + queryEventIDs + "'))) AND " + //inserted single quotes
here if i am adding consultant name and selecting multiple events(say 2 events),i am getting the details of 1 event. if i am entering consultant name and start date and end date,i am getting the excel file correctly. The problem is single quotes(' ').what changes is needed in that line so that it should work with all the fields??
I am selecting 2 ids and passing it to queryeventIDs.
out of that 2 ids,it is considering only 1 id and give the results,it is skipping 2nd id.
But,when i use the same without single quotes,it is considering both the ids and give me the result.
Might be it is taking like this,