hi guys,
I wanted to get a result of a certain field by passing a month and year parameter to access database,the day parameter isn't important.So i used this query and it raised an exception.The record exists but it says there's no data for that column.
Any help would be appreciated.
qry = "SELECT * FROM [fuel_allowance] WHERE [project number]='" & projcode & "' AND [employee number]='" & empcode & "'" & _
"AND MONTH([current month])=" & currentdate.Month & " AND YEAR([current month])=" & currentdate.Year & ""
Dim dr As OleDb.OleDbDataReader = GetData(qry)
If dr.HasRows = True Then
TextBox32.Text = dr.Item("fuel/litre")
Else
MsgBox("Fuel allowance not defined for the current month of " & MonthName(currentdate.Month, False), MsgBoxStyle.Information, "Project Payroll")
Exit Sub
End If