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. Advertisements

  2. 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 aka Kudzu, Feb 16, 2004
    #2
    1. Advertisements

  3. Jimmy Crider

    Jimmy Crider Guest

    I am excuting in succession,
    How to avoid then ?
    thanks for your thoughts.
    Jimmy
     
    Jimmy Crider, Feb 16, 2004
    #3
  4. Make a variable of type that Parameters returns and store it. Then use it
    instead.
     
    Chad Z. Hower aka Kudzu, Feb 18, 2004
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.