在C#应用程序中,应该创建一个OleDBConnection一次,还是每次执行一个sql语句?
我正在看别人写的C#代码.每个sql语句之前都是创建一个连接字符串指向MDB数据库的OleDbConnection对象.
每次创建OleDbConnection对象是合适的,还是应该在应用程序的开始创建对象,然后从中使用.
解决方法
根据
Best Practices for Using ADO.NET:
High performance applications keep connections to the data source in use for a minimal amount of time,as well as take advantage of performance enhancing technology such as connection pooling…