public System.Data.OleDb.OleDbConnection strconn = null
//获取datatable数据
public DataTable AExcuToTable(string sql)
{
DataTable dv = null
// System.Data.OleDb.OleDbConnection strconn=null
try
{
strconn = new System.Data.OleDb.OleDbConnection(strConnection)
if (strconn.State == ConnectionState.Closed)
strconn.Open()
System.Data.OleDb.OleDbDataAdapter oa = new System.Data.OleDb.OleDbDataAdapter(sql, strconn)
System.Data.DataSet ds = new DataSet()
oa.Fill(ds, "Table")
dv = ds.Tables["Table"]
}
catch
{
return null
}
strconn.Close()
return dv
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)