hi Developers ,
when i retrive datas from database i got the following error.
OleDb Exception Was Unhandled
Data type mismatch in criteria expression. (Using Ms Access db)
i don't know what is wrong with my code.below am adding my using code
string str = "select AttendanceLogs.*,Shifts.EndTime,Shifts.BeginTime,Shifts.Break1,Shifts.Break1BeginTime,Break1EndTime from AttendanceLogs inner join Shifts on Shifts.ShiftId = AttendanceLogs.ShiftId where AttendanceDate between '" + sDate + "' AND '" +tDate + "' and EmployeeId ='" + edr.GetValue(0) + "'";
OleDbCommand getLogs = new OleDbCommand(str, Conn);
OleDbDataReader dr = getLogs.ExecuteReader();
so please suggest me if i done any wron in my code.
thanks with
Paul.S
Download FREE API for Word, Excel and PDF in ASP.Net:
Download
Andrea
on May 03, 2017 02:40 AM
1
dharmendr
on May 03, 2017 03:13 AM
on May 03, 2017 03:14 AM
2
paulrajmca says:
string
str =
"select AttendanceLogs.*,Shifts.EndTime,Shifts.BeginTime,Shifts.Break1,Shifts.Break1BeginTime,Break1EndTime from AttendanceLogs inner join Shifts on Shifts.ShiftId = AttendanceLogs.ShiftId where AttendanceDate between '"
+ sDate +
"' AND '"
+tDate +
"' and EmployeeId ='"
+ edr.GetValue(0) +
"'"
;
Change the above line with the below.
string str = "select AttendanceLogs.*,Shifts.EndTime,Shifts.BeginTime,Shifts.Break1,Shifts.Break1BeginTime,Break1EndTime from AttendanceLogs inner join Shifts on Shifts.ShiftId = AttendanceLogs.ShiftId where AttendanceDate between ('" + sDate + "' AND '" + tDate + "') and EmployeeId = " + edr.GetValue(0);
Guessing your employeeId is integer. That might be the cause.