M
Mike
Hi,
Sorry I am new to object oriented.
I was trying to build a class from which I could retrieve DataSets, DataReader, execute SQL, etc. Some kind of SQL class. I thought that creating methods such as "RunSql" and "RunProc" would be a good idea, but then realized that it is not possible to create method overloading as follows:
public DataSet RunSql(string sSql, string sTableName)
public DataReader RunSql(string sSql)
public void RunSql(string sSql)
The above won't work, since the first two methods have the same signature. Is there a nice way of keeping the method name the same (RunSql) but return a different object? I was thinking about "Object" as return parameter, but won't there be a performance problem since casting is involved? Or should I just create different method with "getDataSet(...)", "getDataReader(...)", etc.?
Thanks
Mike
Sorry I am new to object oriented.
I was trying to build a class from which I could retrieve DataSets, DataReader, execute SQL, etc. Some kind of SQL class. I thought that creating methods such as "RunSql" and "RunProc" would be a good idea, but then realized that it is not possible to create method overloading as follows:
public DataSet RunSql(string sSql, string sTableName)
public DataReader RunSql(string sSql)
public void RunSql(string sSql)
The above won't work, since the first two methods have the same signature. Is there a nice way of keeping the method name the same (RunSql) but return a different object? I was thinking about "Object" as return parameter, but won't there be a performance problem since casting is involved? Or should I just create different method with "getDataSet(...)", "getDataReader(...)", etc.?
Thanks
Mike