Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. dataset

dataset

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amit__8
    wrote on last edited by
    #1

    how to find out a null or blank value within a dataset in asp.net/vb.net

    V 1 Reply Last reply
    0
    • A amit__8

      how to find out a null or blank value within a dataset in asp.net/vb.net

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #2

      what do you mean? dataset is null? Table is null? Row is null? column is null? Or 1 cell is null? "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

      A 1 Reply Last reply
      0
      • V V 0

        what do you mean? dataset is null? Table is null? Row is null? column is null? Or 1 cell is null? "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        not row not column i am talking about only CELL let me know if u have any solution

        V 1 Reply Last reply
        0
        • A Anonymous

          not row not column i am talking about only CELL let me know if u have any solution

          V Offline
          V Offline
          V 0
          wrote on last edited by
          #4

          This is C#, don't know how to do it in VB.NET 1: foreach(DataRow row in yourdataset.Tables[0].Rows){ if(row[index] == null){ //index can be a number or string } //end if } //end foreach 2: if(yourdataset.Tables[0].Rows[index].ItemArray[index] == null){ } //end if Note that you have to know which index to use, especially if you have more then 1 table. hope this helps... "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

          S 1 Reply Last reply
          0
          • V V 0

            This is C#, don't know how to do it in VB.NET 1: foreach(DataRow row in yourdataset.Tables[0].Rows){ if(row[index] == null){ //index can be a number or string } //end if } //end foreach 2: if(yourdataset.Tables[0].Rows[index].ItemArray[index] == null){ } //end if Note that you have to know which index to use, especially if you have more then 1 table. hope this helps... "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

            S Offline
            S Offline
            Scott Serl
            wrote on last edited by
            #5

            >if(yourdataset.Tables[0].Rows[index].ItemArray[index] == null){ > >} //end if this only checks if the object is null, not if the database field value is null. You have to compare the value to system.dbnull.value: if(yourdataset.Tables[0].Rows[index].ItemArray[index] == DBNull.Value){ } //end if In VB.Net: If yourdataset.Tables[0].Rows[index].ItemArray[index] = DBNull.Value Then 'Do something special Else 'Do your regular thing End If

            V 1 Reply Last reply
            0
            • S Scott Serl

              >if(yourdataset.Tables[0].Rows[index].ItemArray[index] == null){ > >} //end if this only checks if the object is null, not if the database field value is null. You have to compare the value to system.dbnull.value: if(yourdataset.Tables[0].Rows[index].ItemArray[index] == DBNull.Value){ } //end if In VB.Net: If yourdataset.Tables[0].Rows[index].ItemArray[index] = DBNull.Value Then 'Do something special Else 'Do your regular thing End If

              V Offline
              V Offline
              V 0
              wrote on last edited by
              #6

              To be honoust I don't really understand? The yourdataset.Tables[0].Rows[index].ItemArray[index] has some value. It's this value that is compared with null, no? If I'm wrong can you point me out the difference ? tnx. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

              S 1 Reply Last reply
              0
              • V V 0

                To be honoust I don't really understand? The yourdataset.Tables[0].Rows[index].ItemArray[index] has some value. It's this value that is compared with null, no? If I'm wrong can you point me out the difference ? tnx. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

                S Offline
                S Offline
                Scott Serl
                wrote on last edited by
                #7

                null means that the object does not reference an instance of any object. When you declare a variable, but have not set a value to it, it is null. When you query a database, you get back the values stored in the columns you requested. The column exists (or you would get an error), so the Item is not null; it references an object representing the value of the database column for that DataRow. The .net framework provides a special value (System.DBNull) that you can use to see if the value of the Item is Null in the database.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups