Ad
Server Error In '/' Application VB.NET
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
Related Questions
- → I can't do a foreign key, constraint error
- → How to implement DbDongle::convertTimestamps as workaround of invalid timestamps with MySql strict
- → MySQL error "Foreign key constraint is incorrectly formed"
- → Eloquent Multitable query
- → "Laravel 5.1" add user and project with userId
- → Database backup with custom code in laravel 5 and get the data upto 10 rows from per table in database
- → Laravel 5.1 QueryException when trying to delete a project
- → Using Array in '->where()' for Laravel Query Building
- → Chaining "Count of Columns" of a Method to Single Query Builder
- → Laravel Eloquent Joining Strange query
- → convert time using mysql laravel 5
- → How to update a column after an expiration date in MySQL?
- → Foreign key constraint fails on existing key
Ad