日期:2014-05-18 浏览次数:20752 次
public DataTable GetDataTable(string strsql) { conn=new SqlConnection(cnstr); DataTable dttmp = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter(strsql, conn); try { adp.Fill(dttmp); } catch (Exception ex) { if (conn.State != ConnectionState.Closed()) { conn.Close(); } } finally { adp.Dispose(); return dttmp; } }