checking the null values in the database column............

Discussion in 'ASP .Net' started by Jimmy Crider, Feb 16, 2004.

  1. Jimmy Crider

    Jimmy Crider Guest

    Hello all,
    Here is my code to check the Null value in a column.
    Please let me know the way I coded can be fine tuned.

    If Not Covert.IsDBNull(mycommandObject.Parameters("MycoulmnName").Value)
    then
    MyTextBox.Text = mycommandObject.Parameters("MycoulmnName").Value
    End If
    Thats the way I coded to check the null value in my read column. Is there
    any better way or did I wrote the efficient code here ?
    Thanks for your advice.
    Jimmy
    Jimmy Crider, Feb 16, 2004
    #1
    1. Advertising

  2. "Jimmy Crider" <> wrote in news:#9SCEZN9DHA.2480
    @TK2MSFTNGP10.phx.gbl:
    > If Not Covert.IsDBNull(mycommandObject.Parameters("MycoulmnName").Value)
    > then
    > MyTextBox.Text = mycommandObject.Parameters("MycoulmnName").Value
    > End If
    > Thats the way I coded to check the null value in my read column. Is there
    > any better way or did I wrote the efficient code here ?


    You are accessing the Parameters twice which is a little slow. You could
    store value in a variable, then access it twice. That would be faster.

    But unless this is in a loop that will be executed over and over in tight
    succession, you likely wont see any difference.


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"
    Chad Z. Hower aka Kudzu, Feb 16, 2004
    #2
    1. Advertising

  3. Jimmy Crider

    Jimmy Crider Guest

    I am excuting in succession,
    How to avoid then ?
    thanks for your thoughts.
    Jimmy


    "Chad Z. Hower aka Kudzu" <> wrote in message
    news:Xns949225951533cpub@127.0.0.1...
    > "Jimmy Crider" <> wrote in news:#9SCEZN9DHA.2480
    > @TK2MSFTNGP10.phx.gbl:
    > > If Not Covert.IsDBNull(mycommandObject.Parameters("MycoulmnName").Value)
    > > then
    > > MyTextBox.Text = mycommandObject.Parameters("MycoulmnName").Value
    > > End If
    > > Thats the way I coded to check the null value in my read column. Is

    there
    > > any better way or did I wrote the efficient code here ?

    >
    > You are accessing the Parameters twice which is a little slow. You could
    > store value in a variable, then access it twice. That would be faster.
    >
    > But unless this is in a loop that will be executed over and over in tight
    > succession, you likely wont see any difference.
    >
    >
    > --
    > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    > "Programming is an art form that fights back"
    Jimmy Crider, Feb 16, 2004
    #3
  4. "Jimmy Crider" <> wrote in news:OU238#N9DHA.1112
    @tk2msftngp13.phx.gbl:
    > I am excuting in succession,
    > How to avoid then ?


    Make a variable of type that Parameters returns and store it. Then use it
    instead.


    --
    Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
    "Programming is an art form that fights back"
    Chad Z. Hower aka Kudzu, Feb 18, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason
    Replies:
    1
    Views:
    730
    Karl Seguin
    Sep 27, 2004
  2. Replies:
    5
    Views:
    26,492
    Mike Schilling
    Mar 29, 2006
  3. =?Utf-8?B?TWFydHluIEZld3RyZWxs?=

    VB.Net - checking for Null values in DataSets

    =?Utf-8?B?TWFydHluIEZld3RyZWxs?=, Aug 1, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    40,026
    pro.rakesh
    Aug 7, 2009
  4. Fuzzydave

    Python checking for None/Null values

    Fuzzydave, Aug 11, 2006, in forum: Python
    Replies:
    9
    Views:
    125,174
    Fuzzydave
    Aug 11, 2006
  5. Replies:
    2
    Views:
    430
Loading...

Share This Page