D
DaveK
I recently came across the Microsoft Data Access Application Block so I
decided to try it out in a Windows forms application. Without using the
DAAB, the following code, which creates a data reader which is then
used to populate a combo box, takes 3 seconds to run:
SqlConnection cn = new SqlConnection("server=.......")
commandString = "select ......"
SqlCommand cmd = new SqlCommand(commandString, cn);
SqlDataReader dr = cmd.ExecuteReader();
The command string is a simple select statement on one table which
returns the primary key for about 10 records.
After installing the DAAB I modified the code as follows:
Database db = DatabaseFactory.CreateDatabase();
commandString = "select ......"
DBCommandWrapper dbCommandWrapper(commandString);
IDataReader DataReader = db.ExecuteReader(dbCommandWrapper);
This code takes 6 seconds to run, twice as long. I can see the
advantages of using the DAAB, but this performance overhead is too
great. Is this to be expected when using the DAAB or am I missing
something?
decided to try it out in a Windows forms application. Without using the
DAAB, the following code, which creates a data reader which is then
used to populate a combo box, takes 3 seconds to run:
SqlConnection cn = new SqlConnection("server=.......")
commandString = "select ......"
SqlCommand cmd = new SqlCommand(commandString, cn);
SqlDataReader dr = cmd.ExecuteReader();
The command string is a simple select statement on one table which
returns the primary key for about 10 records.
After installing the DAAB I modified the code as follows:
Database db = DatabaseFactory.CreateDatabase();
commandString = "select ......"
DBCommandWrapper dbCommandWrapper(commandString);
IDataReader DataReader = db.ExecuteReader(dbCommandWrapper);
This code takes 6 seconds to run, twice as long. I can see the
advantages of using the DAAB, but this performance overhead is too
great. Is this to be expected when using the DAAB or am I missing
something?