Best Way to populate Data...please help

Best Way to populate Data...please help

Post by Hinrich Spec » Wed, 28 May 2003 22:57:07



Hi,

i am writing a windows app (vb.net) that uses different databases (MS
SQL, Oracle9i,...). The database used for a decent module of the app
can change from time to time - so the goal is to have a generic
database access layer (wrapper) to connect to the different databases.
 This works fine as long as i return a dataset, because its
disconnected and dbms-independent (my wrapper fills the dataset by
using the appropriate dataadapter and returns the dataset).
Now the problem: Sometimes i need to read large amounts of data (about
200.000 rows). In this case the dataadapter/dataset becomes too slow,
therefore i want to use a datareader. But since the datareader is not
dbms-independent, id have to struggle with different datareaders in
my modules again (and thats what I dont want to do).
So my question is: does anybody know a good way to get the data of the
datareader into my modules without having them to know which dbms the
data came from? One way would be to populate the data to a datatable,
but in this case I could also use a dataadapter...

Thanks in advance,

Hinrich

 
 
 

Best Way to populate Data...please help

Post by bruce barke » Thu, 29 May 2003 00:57:04


implement your own IDataReader that can abstract the features you want from
the underlying dbm's.

-- bruce (sqlwork.com)


Quote:> Hi,

> i am writing a windows app (vb.net) that uses different databases (MS
> SQL, Oracle9i,...). The database used for a decent module of the app
> can change from time to time - so the goal is to have a generic
> database access layer (wrapper) to connect to the different databases.
>  This works fine as long as i return a dataset, because its
> disconnected and dbms-independent (my wrapper fills the dataset by
> using the appropriate dataadapter and returns the dataset).
> Now the problem: Sometimes i need to read large amounts of data (about
> 200.000 rows). In this case the dataadapter/dataset becomes too slow,
> therefore i want to use a datareader. But since the datareader is not
> dbms-independent, id have to struggle with different datareaders in
> my modules again (and thats what I dont want to do).
> So my question is: does anybody know a good way to get the data of the
> datareader into my modules without having them to know which dbms the
> data came from? One way would be to populate the data to a datatable,
> but in this case I could also use a dataadapter...

> Thanks in advance,

> Hinrich


 
 
 

1. can't populate update parameters! please help

the below code is causing this error on the line in the for loop that tries
to populate the param with "TESTING!" :

"Invalid string of 'description' for SourceParameter lookup in
ParameterMapping collection".

But description is not just the problem, even filename doesn't work when i
switch around the code and try writing that parameter.  This is so
frustrating, i'm thinking of abandoning this technique and going back to a
regular update command and passing in the variables manually. Perhaps the
OleDbType is wrong, but VarChar isn't giving me an error.  In Oracle, its
defined as varchar2...

Here's the code, thanks in advance:
_______________________________

OleDbCommand myCommand = new OleDbCommand(updateCmd, myConnection);

myCommand.Parameters.Add(new


OleDbType.VarChar, 250, "DESCRIPTION"));


50, "FILENAME"));


myDataGrid.DataKeys[(int)e.Item.ItemIndex];

String[] cols = {"image_seq_no","description","filename"};

 for (int i=2; i<3; i++)     // skip first col, the primary key
 {
    myCommand.Parameters[cols[i]].Value = "TESTING!";
  }

2. HELP: Networking "mystery" on SS5

3. Best Approach...Please Help..!

4. Questions regarding PocketPC and networks

5. suche deutschsprachige newsgroup

6. Best technique ? Please help

7. Survey on Peopleware

8. Please help-- need best practices to build a web reporting application

9. standard ways to provide help?

10. recommended ways to provide help?