in my function i am returning a datatable that is returned by method
MyDatatable(sqlQuery, connection ),
but it may generate some exceptions that will threw error can i do something like this
return try {cmn.MyDatatable(qry, con)} catch(Exception ex){null};
i don’t want to do this way
DataTable dt =null;
try{
dt = cmn.MyDatatable(qry, con);
}catch().....
return dt==null ? null :dt;
Your syntax is quite wrong. You can do it this way:
Although I doubt you want to swallow all exceptions.