Link to home
Create AccountLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net SQL Object reference not set to an instance of an object

Hi

I get an error in the following SQL "Object reference not set to an instance of an object"
It was when I introduced the last bit "AND Co_ID = 1"
What is wrong with my syntax? thanks

SELECT DISTINCT Period FROM Periods WHERE [Start Date] <= CAST('08 November 2012' as date) AND [End Date] >= CAST('08 November 2012' as date) AND Co_ID = 1
ASKER CERTIFIED SOLUTION
Avatar of Wim_Bl
Wim_Bl
Flag of Belgium image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Murray Brown

ASKER

Thanks. It was a problem at tabular level as you suggested
Avatar of kaufmed
This is a .NET error message, and it should have nothing to do with the actual query itself--unless you are trying to refer to .NET variables within the query (e.g. via string concatenation). Can you display the code where this is used?