That doesn't seem like it would be very efficient.
What are you going to do with them after that.
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
Using generics will not help you with that function.
As a matter of fact, if you study how the IDataReader is created, you have some syntax that has to be re-written to be of real use.
I played around with the concept and came up with SOMETHING that is purely syntax and not functional in a manner anyone should use.
PROOF OF CONCEPT ONLY:
using System.Data;
using System.Data.OracleClient;
namespace DW_407917_CS_CON
{
class CGTest<T, U, V>
where U : IDbCommand
where V : IDataReader
{
private string _strSQL { get; set; }
private OracleCommand _cmd { get; set; }
private OracleDataReader _rdr { get; set; }
public CGTest(T strSql, U cmd, V rdr)
{
_strSQL = strSql.ToString();
_cmd = cmd as OracleCommand;
_rdr = rdr as OracleDataReader;
}
public void PreviousValue()
{
OracleConnectionStringBuilder csb = new OracleConnectionStringBuilder();
// fix parameters of builder here
using (OracleConnection conn = new OracleConnection(csb.ToString()))
{
conn.Open();
_cmd = new OracleCommand(_strSQL, conn);
using (_rdr = _cmd.ExecuteReader())
{
while (_rdr.Read())
{
//copy from rdr to variables
}
//
_rdr.Close();
}
//
conn.Close();
}
}
}
class Program
{
static void Main(string[] args)
{
OracleCommand cmd = new OracleCommand();
OracleDataReader rdr = null;
CGTest<string, OracleCommand, OracleDataReader> test =
new CGTest<string, OracleCommand, OracleDataReader>
("select * from db", cmd, rdr);
test.PreviousValue();
}
}
}
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402