char HeadType = _session.HeadType; var res = db.DispHed(_session.CompId; DataView dv = _global.ToDataTable(db, res).DefaultView;
public DataTable ToDataTable(System.Data.Linq.DataContext ctx, object query) { DataTable dt = new DataTable(); if (query != null) { IDbCommand cmd = ctx.GetCommand(query as IQueryable); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = (SqlCommand)cmd; try { cmd.Connection.Open(); adapter.FillSchema(dt, SchemaType.Source); adapter.Fill(dt); } finally { cmd.Connection.Close(); } } return dt; }
Value cannot be null. Parameter name: query
query as IQueryable
ctx.GetCommand
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)