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
  1. Home
  2. General Programming
  3. Visual Basic
  4. How To assign null value into nullable object

How To assign null value into nullable object

Scheduled Pinned Locked Moved Visual Basic
tutorial
5 Posts 2 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.
  • M Offline
    M Offline
    MehdiMousaviNezhad
    wrote on last edited by
    #1

    I have A TableAdapter and wana To assign Null value To It's Parameter I use Dbnull.value But I cant

    D 1 Reply Last reply
    0
    • M MehdiMousaviNezhad

      I have A TableAdapter and wana To assign Null value To It's Parameter I use Dbnull.value But I cant

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Without seeing the code that's having the problem and the error messages, it's pretty much impossible to tell you what you're doing wrong.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Without seeing the code that's having the problem and the error messages, it's pretty much impossible to tell you what you're doing wrong.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        M Offline
        M Offline
        MehdiMousaviNezhad
        wrote on last edited by
        #3

        I have this code in as Procedure in SqlServer alter PROC Aut.SpGetArshive(@userId Int,@SecID bigint) AS BEGIN SELECT *,str(isnull(a.Row,0))+' '+a.Title+ ' ('+a.Zonkan+')' AS des FROM aut.Archive a WHERE (a.UserId IS NULL AND a.SecId=@secId) OR (a.SecId IS NULL AND a.UserId=@userId) END and have this table adapter in vb.net 2005 dataset SpGetArshiveTableAdapter.Fill(Me.Ds.SpGetArshive, UserID, SecID) and I wana pass null value to userId but Icant I Use SpGetArshiveTableAdapter.Fill(Me.Ds.SpGetArshive, dbnull.value, SecID) or SpGetArshiveTableAdapter.Fill(Me.Ds.SpGetArshive, nothing, SecID) but there is Error tanx

        D 1 Reply Last reply
        0
        • M MehdiMousaviNezhad

          I have this code in as Procedure in SqlServer alter PROC Aut.SpGetArshive(@userId Int,@SecID bigint) AS BEGIN SELECT *,str(isnull(a.Row,0))+' '+a.Title+ ' ('+a.Zonkan+')' AS des FROM aut.Archive a WHERE (a.UserId IS NULL AND a.SecId=@secId) OR (a.SecId IS NULL AND a.UserId=@userId) END and have this table adapter in vb.net 2005 dataset SpGetArshiveTableAdapter.Fill(Me.Ds.SpGetArshive, UserID, SecID) and I wana pass null value to userId but Icant I Use SpGetArshiveTableAdapter.Fill(Me.Ds.SpGetArshive, dbnull.value, SecID) or SpGetArshiveTableAdapter.Fill(Me.Ds.SpGetArshive, nothing, SecID) but there is Error tanx

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          How about a couple of examples of SQL stored procedure "optional paramters" -> http://weblogs.asp.net/rmclaws/archive/2004/02/18/75381.aspx[^], and http://sqlserver2000.databases.aspfaq.com/can-i-have-optional-parameters-to-my-stored-procedures.html[^]. The idea is to set the parameter to NULL (default value) inside the procedure, then just set the userID parameter in your code when you need to use it.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          M 1 Reply Last reply
          0
          • D Dave Kreskowiak

            How about a couple of examples of SQL stored procedure "optional paramters" -> http://weblogs.asp.net/rmclaws/archive/2004/02/18/75381.aspx[^], and http://sqlserver2000.databases.aspfaq.com/can-i-have-optional-parameters-to-my-stored-procedures.html[^]. The idea is to set the parameter to NULL (default value) inside the procedure, then just set the userID parameter in your code when you need to use it.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            M Offline
            M Offline
            MehdiMousaviNezhad
            wrote on last edited by
            #5

            tanx I changed my procedure .

            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