|
-
Sep 20th, 2000, 03:42 AM
#1
Thread Starter
Hyperactive Member
Hello Gurus,
I'm trying to test for a null or no data in a field from
an MS SQL table.
e.g I have 3 fields (Emp_Id,Emp_Name,Emp_Dob)
I need to check if the Emp_Dob (Date field) has been entered.
I thought just doing something like this would be enough:
Code:
cn.Connect = "uid=sa;pwd=;server=" & txtsvr & ";driver={SQL Server};database=" & txtdb & ";"
cn.CursorDriver = rdUseIfNeeded
cn.EstablishConnection rdDriverNoPrompt
cn.GetData <- Executes the SQL statement
Set RS = cnclearjob.LastQueryResults
Do Until RS.EOF
If RS("Emp_Dob") = Null Then
Check1.Value = 1
MsgBox ("DOB Empty!")
End If
RS.Movenext
Loop
Unfortunately, VB doesnt recoginise that the empty value in the field, so ignores the 'IF' statement, even if I change the statement to (IF RS("Emp_Dob")= "" then ...... that doesnt work either!
Anyone shed some light on this!!!??
Cheers
Craig.
-
Sep 20th, 2000, 04:52 AM
#2
Fanatic Member
Try
Code:
If IsNull(RS!Emp_Dob)
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
-
Sep 20th, 2000, 06:10 AM
#3
Thread Starter
Hyperactive Member
Hey, Thanks a lot.... that did the trick!!
Thanks Again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|