I'm about done with a personal application im making for my small furniture factory. I'm having a little problem retrieving the total sum of my employee's loans discounts.It comes up perfectly using the statement:
"SELECT sum(TotalDiscount)as TotalDiscount FROM EmployeeDiscounts WHERE EmployeeID=val(" + Me.txtEmployeeID.Text + ")and PayRollID=val(" + Me.TxtPayrollID.Text + ")"
the problem is that it only works when the employee has discounts but if the database if empty it gives me this error:
"Conversion from type 'DBNull' to type 'String' is not valid."
I want to look up database and if it is empty then display "$0.00" in TotalDiscounts textbox.
I have tried every way possible but cant seem to make it work.PLEASE HELP!!