Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning an object back?
Message
 
 
To
20/02/2013 10:51:37
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01566475
Message ID:
01566492
Views:
46
>>>>Hi everybody,
>>>>
>>>>I am wondering if what I've written is OK or it's better to use boolean merhod here and return row as a parameter?
>>>>
>>>>
>>>>/// <summary>
>>>>        /// Returns row for Pass table
>>>>        /// </summary>
>>>>        /// <param name="sqlCommand"></param>
>>>>        /// <returns></returns>
>>>>        public DataRow GetPassRow(SqlCommand sqlPassCommand, ref String messageText, ref Int32 statusCode)
>>>>        {
>>>>            DataSet ds;
>>>>            if (database.ExecuteSqlCommand(sqlPassCommand, out ds, ref messageText, ref statusCode))
>>>>                return ds.Tables[0].Rows[0];
>>>>            else
>>>>                return new DataRow(); // Empty data row
>>>>        }
>>>>
>>>>The problem I see here is how should I examine the result of this method when I call it? Perhaps it's better to use the out parameter?
>>>
>>>
>>>Interesting question - How is this supposed to work ?
>>>
>>>return new DataRow(); // Empty data row
>>>
>>>>Thanks in advance.
>>
>>I've been thinking that I do not want such method at all. It serves no real purpose and only complicates things. I am going to embed this code directly in the bigger method.
>
>
>Yes, but you haven't answered the question

The above is probably a mistake - I may want to return null instead.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform