473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
3 1758
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: madsgormlarsen | last post by:
Hi I need to test a field(colum) in a SQL database for for NULL values, and have done so in this way. $query = "SELECT j FROM Andersen"; $result = mysql_query($query, $link_id); $query_data...
26
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
3
by: A.M. de Jong | last post by:
Reading a lot about Nulls right now I still can't find a Technical reason to use it or not. For what I've understand is this: In an Ingres database a Null column has a standard extra storage...
10
by: Bodza Bodza | last post by:
I'm having an argument with an incumbent self-taught programmer that it is OK to use null foreign keys in database design. My take is the whole point of a foreign key is that it's not supposed...
7
by: am72de | last post by:
Hi all, I've posted this problem some weeks ago, but noone had a solution. Perhaps now someone could help me. I have the following tables: Create Table T1 ( ID1 int Not Null , ID2 int Not...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
3
by: binder | last post by:
I am designing a new table with a few columns that may or may not have a value on each row that is inserted. What issues determine whether to allow a NULL value to be inserted for that column or...
4
by: Eric Layman | last post by:
Hi everyone, Im puzzled by a NULL behaviour in SQL 2000 server. There is a column in the table that does not allow NULL. During data mining, the staff noted that, for that particular column,...
1
by: kannan1983 | last post by:
In a table i have to check each and every column for null values . if the column has null value i need to display as ' NULL VALUE' in the output , for these iam declaring some local variables Iam...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.