Inserting class collection data into Access database

  • Thread starter Thread starter obb_taurus
  • Start date Start date
O

obb_taurus

Hi,

I'm working on a C# Winform application and have a number of
collection classes within my application, at present I'm using the
obedb executenonquery method and looping through my class object with
a foreach statement to insert the data into the database which is not
efficient by any stretch. I've been looking for a better solution but
haven't been able to find any, I know datasets are an option as well
but I would prefer a more direct solution.

Thanks in advance for your help.

Mike
 
With Access, that's all you get.

foreach loops

..........

However, you can check this out for .... parameterized queries over sql
strings.

http://www.15seconds.com/issue/020919.htm
There are two main conclusions that can be drawn from these results.


a.. First, if you are executing the same dynamic queries every time in
your script (i.e. without any variables), significant performance gains (in
this case, 36%) can be achieved simply by switching to Stored Queries. With
this comes the aforementioned fringe benefit of increased ease of query
administration. For queries which do contain variables, there are still
performance gains to be had, but they are less significant (8% for the query
tested).

b.. Second (and contrary to my own expectations), using the Command
object's Parameters collection in preference to simply appending the
parameter values to the end of the stored query SQL statement yields only a
minor performance increase. In practice it may be worth completely avoiding
this collection, especially since it is since the extra complication that it
adds to your scripts (i.e. creating parameter objects, defining the data
type, setting the value, and then adding the parameter object to the
collection) may not

You might look at this...
http://www.codeproject.com/dotnet/ELAB.asp
but I've never dealt with it.


Access is NOT a RDBMS.
 
Hi,

I'm working on a C# Winform application and have a number of
collection classes within my application, at present I'm using the
obedb executenonquery method and looping through my class object with
a foreach statement to insert the data into the database which is not
efficient by any stretch. I've been looking for a better solution but
haven't been able to find any, I know datasets are an option as well
but I would prefer a more direct solution.

Thanks in advance for your help.

Mike

If you don't want to use a dataset, then you are doing it properly.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Back
Top