Link to home
Start Free TrialLog in
Avatar of Jennifer Barman
Jennifer BarmanFlag for United States of America

asked on

IF THEN statement IF NULL in ASP.NET Visual studio 2008

I would think this would be an easy answer, but I have not been able to resolve this for a few hours now... What I need is to create an if then statement saying if this textbox is null then do this: ..... I can't seem to code the correct statement for this to work.. It is happening on a button click. When they click on the UPDATE button in my app... I need it to look at the data that is being passed into my database and if it is NULL then I need it to pop up an alert box. Now I have the programming correct for the alert box. I tested it to where I put in a IF = "cat" then do... and it popped the box right up.. but now when I am trying to tell it to look if it is null it is not working.. Here is the code that I am working on...
If IsDBNull(patient_id.Text) Then
                UserMsgBox(Me, "Must Insert Patient ID.")
                Exit Sub
            End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Andrew Crofts
Andrew Crofts
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Umar Topia
Umar Topia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If DBNull.Value == patient_id.Text
Then                 UserMsgBox(Me, "Must Insert Patient ID.")                
Exit Sub            
End If
Avatar of Jennifer Barman

ASKER

Both of these worked!!! :) I knew it was easy!! I tried the first one suggested before, but I think I had my statement in the wrong place!! THANKS FOR ALL ASSISTANCE!! LIFE SAVER!! :) :)