Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is better? Faster?

Status
Not open for further replies.

bigfoot

Programmer
May 4, 1999
1,779
US
I'm checking for null in the table as I am opening it.

This:
txtCustST.Text = row.Item("CustST") & ""

Or This:
txtCustZip.Text = IIf(IsDBNull(row.Item("CustZip")), "", row.Item("CustZip"))

'It works on int fields too
txtSalesNumber.Text = IIf(IsDBNull(row.Item("SalesNumber")), 0, row.Item("SalesNumber"))


I would thik a concatination is faster then a decision.
What do you all think?

And if the concat (&) works better, then how do you handle numeric fields? The same way:
txtCustST.Text = row.Item("SalesNumber") & ""
 
Why not use ildasm.exe to see which one produces fewer MSIL statements?

Chip H.
 
Bigfoot, may i ask you two questions? Do you have your fields in your database set to allow zero length strings?

Thank you,
 
It's a SQL Server database, and I have allow nulls turned on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top