try
{
SqlCommand cmd = new SqlCommand(SELECT [Name], COUNT([Name]) AS Count FROM [DelegationTracker] WHERE [Date] = @Date GROUP BY [Name], Connection);Conn);
SqlCommand cmd = new SqlCommand(SELECT @User_Tested FROM WHMIS_User_Tests;, Connct);
cmd.Parameters.Clear();
cmd.Parameters.Add(@Name, SqlDbType.VarChar).Value = HttpContext.Current.Session[Name].ToString();
cmd.Parameters.Add(@Date, SqlDbType.VarChar).Value = Date;MMDDYYYY
cmd.Parameters.Add(@Grade, SqlDbType.VarChar).Value = null;
Connection.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
test = reader.GetValue(0).ToString();
test2 = reader.GetValue(1).ToString();
}
}
SqlDataReader dr = cmd.ExecuteReader();
SqlDataAdapter Adapter = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
dt.Load(dr);
Adapter.Fill(dt);
DataSet ds = new DataSet();
Adapter.Fill(ds);
MainGridView.DataSource = dt;
MainGridView.DataSource = ds;
MainGridView.DataBind();
Connection.Close();
return true;
}
假设它没有数据,gridview 不显示即时消息,并且 DataTable 返回 SQL 表中的 1 条记录,但不显示它(在 gridview 中)据我所知,数据集什么也不返回
我有这么多适配器、数据集和数据表的原因是我正在测试看看什么有效,但没有一个产生任何结果......