Hi,
I have an object that I have defined but not initialized. I want to
initialize it in the try{} block, if every thing goes fine I want to return
this object.
What would I return in the catch block? as this function returns the object
type.
Whats wrong with this?
SqlDataReader myReader;
try
{
myreader=cmd.ex ecutereader(str query,connectio nobject);
return myreader;
}
catch
{
return myreader=null;
}
I have an object that I have defined but not initialized. I want to
initialize it in the try{} block, if every thing goes fine I want to return
this object.
What would I return in the catch block? as this function returns the object
type.
Whats wrong with this?
SqlDataReader myReader;
try
{
myreader=cmd.ex ecutereader(str query,connectio nobject);
return myreader;
}
catch
{
return myreader=null;
}
Comment