日期:2014-05-18  浏览次数:20603 次

使用OleDbDataAdapter时OleDbConnection不需要Open()和Close()?
public   DataSet   SelectOleDbSrvRows(DataSet   dataset,string   connection,string   query)  
{
        OleDbConnection   conn   =   new   OleDbConnection(connection);
        OleDbDataAdapter   adapter   =   new   OleDbDataAdapter();
        adapter.SelectCommand   =   new   OleDbCommand(query,   conn);
        adapter.Fill(dataset);
        return   dataset;
}
//使用OleDbDataAdapter时OleDbConnection不需要Open()和Close()?   为什么呢?
//那Open()和Close()是不是被包含在adapter.Fill(dataset)步骤里面了?

------解决方案--------------------
.net自动回收机制
------解决方案--------------------
you 'd better Deal with this problem yourself:Add keywords: open() and Close();
through it can auto complete