wolfen1842
Programmer
I am trying to pull some data from Mas200 into a report that is generated in VB .Net. This report will have a separate line for each agent and each week. Here is the code I am using for the read:
dsEmp.Clear()
lsEmp = "SELECT SUM(Amount) AS Paid " & _
"FROM PR_23PerptHistoryDetail " & _
"WHERE Dept = '" & Mid$(drAgent("PayrollNumber"), 1, 2) & "' " & _
"AND EmployeeNumber = '" & Mid$(drAgent("PayrollNumber"), 3) & "' " & _
"AND CheckDate = {d '" & lsDate & "'} " & _
"AND (EarningCode = '90' OR EarningCode = '97') "
daEmp = New OdbcDataAdapter(lsEmp, cnODBC)
daEmp.Fill(dsEmp, "PR_23PerptHistoryDetail")
tblEmp = dsEmp.Tables("PR_23PerptHistoryDetail")
lsdate is a string field that holds the date in yyyy-mm-dd format.
When I run the report, the first time through this read procedure works fine. However, the second time through, I get the following error when it tries to do the fill command:
"ERROR [3700] [ProvideX][ODBC Driver]Expected lexical element not found: <identifier>"
Any ideas on what that error is? I haven't been able to find it anywhere on the net. Any ideas what I am doing wrong?
Thanks in advance for all the help.
John
dsEmp.Clear()
lsEmp = "SELECT SUM(Amount) AS Paid " & _
"FROM PR_23PerptHistoryDetail " & _
"WHERE Dept = '" & Mid$(drAgent("PayrollNumber"), 1, 2) & "' " & _
"AND EmployeeNumber = '" & Mid$(drAgent("PayrollNumber"), 3) & "' " & _
"AND CheckDate = {d '" & lsDate & "'} " & _
"AND (EarningCode = '90' OR EarningCode = '97') "
daEmp = New OdbcDataAdapter(lsEmp, cnODBC)
daEmp.Fill(dsEmp, "PR_23PerptHistoryDetail")
tblEmp = dsEmp.Tables("PR_23PerptHistoryDetail")
lsdate is a string field that holds the date in yyyy-mm-dd format.
When I run the report, the first time through this read procedure works fine. However, the second time through, I get the following error when it tries to do the fill command:
"ERROR [3700] [ProvideX][ODBC Driver]Expected lexical element not found: <identifier>"
Any ideas on what that error is? I haven't been able to find it anywhere on the net. Any ideas what I am doing wrong?
Thanks in advance for all the help.
John