G
Guest
Hi;
I am porting some code (from java) and I need to do the following on SQL
databases:
I am passed the DbConnection object so I only have the one connection.
Call a select to return a list of rows.
Iterate forward and backwards through the returned rows.
While on a row, perform a second select and iterate through the inner
select. The nested selects can be N layers deep but are not interleaved - an
inner select will be completed and closed before getting the next/previous
row from the outer select.
I retrieve column values based on column name and/or column index. I never
need the results to be placed in a DataSet or any other .net object.
So what is the best approach? In the java world I did this all with
low-level JDBC calls. But from reading the docs it looks like DbDataReader
cannot do a previous and that I cannot nest calls to DbCommand.ExecuteReader
on a single connection.
A lot of the sample code I have seen does not call DbConnection.Open() or
Close(). I assume the Open() is called for me when ExecuteReader() is called.
But don't I have to call Close() to close the connection?
Anything else?
I am porting some code (from java) and I need to do the following on SQL
databases:
I am passed the DbConnection object so I only have the one connection.
Call a select to return a list of rows.
Iterate forward and backwards through the returned rows.
While on a row, perform a second select and iterate through the inner
select. The nested selects can be N layers deep but are not interleaved - an
inner select will be completed and closed before getting the next/previous
row from the outer select.
I retrieve column values based on column name and/or column index. I never
need the results to be placed in a DataSet or any other .net object.
So what is the best approach? In the java world I did this all with
low-level JDBC calls. But from reading the docs it looks like DbDataReader
cannot do a previous and that I cannot nest calls to DbCommand.ExecuteReader
on a single connection.
A lot of the sample code I have seen does not call DbConnection.Open() or
Close(). I assume the Open() is called for me when ExecuteReader() is called.
But don't I have to call Close() to close the connection?
Anything else?