User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,274 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,323 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting

How do I Evaluate Null value from database?

Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: How do I Evaluate Null value from database?

  #9  
Mar 14th, 2008
Here is the code

[WebMethod]
    public int TestDBNullValue(string PID)
    {
        int ErrorValue = 0;
        if (PID.Equals(String.Empty))
        {
            ErrorValue = 10110; //PID is null or empty
        }
        else
        {
            DeviceTableAdapter DeviceAdapter = new DeviceTableAdapter();
            JeanPierre.DeviceDataTable DeviceTable = DeviceAdapter.GetDeviceUIDByPID(PID);

            if (DeviceTable.Count.Equals(0))
            {
                ErrorValue = 1111; //No device found
            }
            else
            {
                JeanPierre.DeviceRow DevRows = DeviceTable[0];

                if(DevRows.TrackingMode.Equals(System.DBNull.Value))
                {
                    ErrorValue = 1;
                }
                else
                {
                    ErrorValue = 41;
                }
            }
        }
        return (ErrorValue);
    }
Reply With Quote  
All times are GMT -4. The time now is 10:19 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC