Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > checking the null values in the database column............

Reply
Thread Tools

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

 
 
Jimmy Crider
Guest
Posts: n/a
 
      02-16-2004
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("Mycoul mnName").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


 
Reply With Quote
 
 
 
 
Chad Z. Hower aka Kudzu
Guest
Posts: n/a
 
      02-16-2004
"Jimmy Crider" <(E-Mail Removed)> wrote in news:#9SCEZN9DHA.2480
@TK2MSFTNGP10.phx.gbl:
> If Not Covert.IsDBNull(mycommandObject.Parameters("Mycoul mnName").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"
 
Reply With Quote
 
 
 
 
Jimmy Crider
Guest
Posts: n/a
 
      02-16-2004
I am excuting in succession,
How to avoid then ?
thanks for your thoughts.
Jimmy


"Chad Z. Hower aka Kudzu" <(E-Mail Removed)> wrote in message
news:Xns949225951533cpub@127.0.0.1...
> "Jimmy Crider" <(E-Mail Removed)> wrote in news:#9SCEZN9DHA.2480
> @TK2MSFTNGP10.phx.gbl:
> > If Not Covert.IsDBNull(mycommandObject.Parameters("Mycoul mnName").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"



 
Reply With Quote
 
Chad Z. Hower aka Kudzu
Guest
Posts: n/a
 
      02-18-2004
"Jimmy Crider" <(E-Mail Removed)> 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"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
VB.Net - checking for Null values in DataSets =?Utf-8?B?TWFydHluIEZld3RyZWxs?= ASP .Net 4 08-07-2009 09:56 AM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
Repeater - checking for null values Jason ASP .Net 1 09-27-2004 06:03 PM



Advertisments