J
john
If I make a bunch of changes to a DataTable and then update its
contents back to the db, ADO.Net formats my changes into update,
insert, and delete statements and executes them on the DB. I have two
questions about this:
1. Should I manually open the connection before updating the
DataTable? It would make sense for the connection to be open the whole
time that ADO.Net is executing all the SQL statements, but maybe it is
smart enough to keep the connection open the whole time without me
telling it to do so.
2. The SQL statements created by ADO.Net are ugly and verbose compared
to what I would create if I was just building the statements in my
code and executing them myself. I am guessing it takes SQL Server
extra time to parse/figure out the ugly/verbose SQL statements created
by ADO.Net. So do I get better performance if I do all my changes to
the DataTable and then call update() on it, or if I don't make any
changes to the DataTable and build the SQL statements myself and
execute them?
Thanks in advance.
john
contents back to the db, ADO.Net formats my changes into update,
insert, and delete statements and executes them on the DB. I have two
questions about this:
1. Should I manually open the connection before updating the
DataTable? It would make sense for the connection to be open the whole
time that ADO.Net is executing all the SQL statements, but maybe it is
smart enough to keep the connection open the whole time without me
telling it to do so.
2. The SQL statements created by ADO.Net are ugly and verbose compared
to what I would create if I was just building the statements in my
code and executing them myself. I am guessing it takes SQL Server
extra time to parse/figure out the ugly/verbose SQL statements created
by ADO.Net. So do I get better performance if I do all my changes to
the DataTable and then call update() on it, or if I don't make any
changes to the DataTable and build the SQL statements myself and
execute them?
Thanks in advance.
john