By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,508 Members | 1,823 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,508 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Jimmy Crider" <JC********@yahoo.com> 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"
Nov 18 '05 #2

P: n/a
I am excuting in succession,
How to avoid then ?
thanks for your thoughts.
Jimmy
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn*****************@127.0.0.1...
"Jimmy Crider" <JC********@yahoo.com> 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"

Nov 18 '05 #3

P: n/a
"Jimmy Crider" <JC********@yahoo.com> 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"
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.