Ad

Server Error In '/' Application VB.NET

- 1 answer

I'm getting this error when I generate my report. It says

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY cdr_id, cdr_extension_no, cdr_datetime, cdr_digits, cdr_destination, ' at line 19

How can I solve this? I am new to vb.net programming.

This is my code:

If String.IsNullOrEmpty(reportFilter) Then
   daEmployee.SetWhereClause(String.Format("cdr_site_id = '{0}' AND a.employee_id IN({1}) AND cdr_datetime BETWEEN '{2}' AND '{3}' AND cdr_call_class_code = 'OUTGOING' AND cdr_call_type_id IN({4}) GROUP BY cdr_id, cdr_extension_no, cdr_datetime, cdr_digits, cdr_destination, cdr_charge_amount, cdr_duration_format, cdr_duration_number, cdr_charge_to, department_code, department_description ORDER BY employee_name", siteId, employeeId, startDateTime, endDateTime, callClass, callType))

Else
   daEmployee.SetWhereClause(String.Format("cdr_site_id = '{0}' AND a.employee_id IN({1}) AND cdr_datetime BETWEEN '{2}' AND '{3}' AND cdr_call_class_code = 'OUTGOING' AND cdr_call_type_id IN({4}) GROUP BY cdr_id, cdr_extension_no, cdr_datetime, cdr_digits, cdr_destination, cdr_charge_amount, cdr_duration_format, cdr_duration_number, cdr_charge_to, department_code, department_description ORDER BY employee_name", siteId, employeeId, startDateTime, endDateTime, callClass, callType))
End If
Ad

Answer

I already solved my problem. The problem is on it's where clause. CDR date time is missing. I'm sorry for disturbing some of you. Thanks for your responses. This is my code:

If String.IsNullOrEmpty(reportFilter) Then
   daEmployee.SetWhereClause(String.Format("cdr_site_id = '{0}' and a.employee_id in ({1}) and cdr_datetime BETWEEN '{2}' AND '{3}' group by cdr_date,cdr_time,cdr_call_type_code ORDER BY employee_name", siteId, employeeId, startDateTime, endDateTime))
Else
   daEmployee.SetWhereClause(String.Format("cdr_site_id = '{0}' and a.employee_id in ({1}) and cdr_datetime BETWEEN '{2}' AND '{3}' group by cdr_date,cdr_time,cdr_call_type_code ORDER BY employee_name", siteId, employeeId, startDateTime, endDateTime))
End If
Ad
source: stackoverflow.com
Ad