EF扩展方法
EF是微软提供的数据库ORM框架,集众家之所长,方便在Winform中使用,可以方便的转换成DataTable,代码如下: using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EF.Winfrom.Context { public static class EFExtendMethod { public static DataTable SqlQueryToDataTable(this Database db, string sql, CommandType type = CommandType.Text, params SqlParameter[] param) { DataTable ret_dt = new DataTable(); SqlConnection conn = db.Connection as SqlConnection; if (conn == null) { conn = new SqlConnection(db