Greenmet29
Member
- Joined
- Apr 29, 2010
- Messages
- 9
- Programming Experience
- 1-3
Hi, I am wondering why my program won't return a row count of zero from a dataset.
This is my code:
The countTrucksQA is:
SELECT COUNT(*) FROM Trucks WHERE truckID=?
It works fine when it finds a truck, returning a value of 1 but when it doesn't return a truck I get an exception of:
"Object variable or with block variable not set"
Any ideas what I might be doing wrong?
This is my code:
VB.NET:
Dim qa As New DataSetTableAdapters.TrucksTableAdapter
Dim i As Integer = qa.countTrucksQA(txtTruckID.Text)
If i >= 1 Then
MsgBox("1")
Else
MsgBox("none")
End If
The countTrucksQA is:
SELECT COUNT(*) FROM Trucks WHERE truckID=?
It works fine when it finds a truck, returning a value of 1 but when it doesn't return a truck I get an exception of:
"Object variable or with block variable not set"
Any ideas what I might be doing wrong?