Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How should I code this?
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01398722
Message ID:
01398759
Views:
61
This message has been marked as a message which has helped to the initial question of the thread.
>Is it OK or not really a good code
>
>
>string strOrderNo = this.txtOrderNo.Text;
>                        int? OrderNo;
>                        if (strOrderNo.Equals(String.Empty))
>                            OrderNo = null;
>                        else
>                            OrderNo = Convert.ToInt32(strOrderNo);
>
>                        _dtOrder = biz.Find(OrderNo, this.dtgStartDate.Value, this.dtgEndDate.Value);
>

That should be fine. I'd probably do something like this, but it's mostly a style preference:
int? orderNo = null;
if (!string.IsNullOrEmpty(strOrderNo))
   orderNo = Convert.ToInt32(strOrderNo);

dtOrder = biz.Find(orderNo, this.dtgStartDate.Value, this.dtgEndDate.Value);
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform