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

  • Thread starter Thread starter Jimmy Crider
  • Start date Start date
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
 
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.
 
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.
 
Back
Top