M
Mojtaba Faridzad
Hi,
I am newbie in C# and I am trying to design my first database program and I
am trying to find the best solution. The database is MySQL.
how do you open your connection in a big application? as I know, I should
open a connection, set the dataset and close the connection. I should open
the connection in "try" block and close the connection in "finally" block.
is that right? I can write a service to pass the query and retreive the
dataset. but if there are many queries in a block of program, on each query,
connection should be opened and closed. is it better to open the query on
the beginning of this block and set all datasets and run all queries, then
close the connection at the end. by this I should have 2 different services,
one with opening and closing the connection, the other just uses the opened
connection.
any idea is appreciated!
I am newbie in C# and I am trying to design my first database program and I
am trying to find the best solution. The database is MySQL.
how do you open your connection in a big application? as I know, I should
open a connection, set the dataset and close the connection. I should open
the connection in "try" block and close the connection in "finally" block.
is that right? I can write a service to pass the query and retreive the
dataset. but if there are many queries in a block of program, on each query,
connection should be opened and closed. is it better to open the query on
the beginning of this block and set all datasets and run all queries, then
close the connection at the end. by this I should have 2 different services,
one with opening and closing the connection, the other just uses the opened
connection.
any idea is appreciated!