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

J

Jimmy Crider

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
 
C

Chad Z. Hower aka Kudzu

Jimmy Crider said:
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.
 
J

Jimmy Crider

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

Chad Z. Hower aka Kudzu

Jimmy Crider said:
I am excuting in succession,
How to avoid then ?

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

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top