Kismet Agbasi
Kismet Agbasi

Reputation: 567

How do I resolve this exception?

Good morning SO,

I'm having a bit of trouble with this query. It works fine when I tested it in the Workbench, but VB is throwing an exception that the column "ccID" is unknown. Am I doing something wrong? My intent is to pull the ccID field and the difference between today and the date in field ccAuthorizedUseEnd.

Your assistance would be greatly appreciated, thanks.

HERE'S THE QUERY I TESTED IN THE MySQL WORKBENCH:

SELECT ccID, DATEDIFF(DATE(NOW()), ccAuthorizedUseEnd) AS Days
FROM accounting.cc_master

HERE'S THE SAME QUERY I'M USING IN VB.NET

Dim dbQuery2 As String = "SELECT ccID, DATEDIFF(DATE(NOW()), ccAuthorizedUseEnd) as Days "

Upvotes: 1

Views: 80

Answers (1)

Bridge
Bridge

Reputation: 30651

You've forgotten your FROM clause in the VB.NET version:

Dim dbQuery2 As String = "SELECT ccID, DATEDIFF(DATE(NOW()), ccAuthorizedUseEnd) as Days FROM accounting.cc_master"

Upvotes: 4

Related Questions