现已将gridview填入数据,想对gridview中的每一列的列名单独赋值,不想要它自动取数据库中的列名,该如何处理? 谢谢各位!SqlConnection ThisCon=new SqlConnection("Server=192.168.0.2;uid=sa;pwd=xstmzdj1zjp2qxsl3;database=erpdb");
SqlCommand Comm = new SqlCommand("prc_jhh_cc_worksatu", ThisCon); Comm.CommandType = CommandType.StoredProcedure;
SqlParameterCollection Params = Comm.Parameters; Params.Add(new SqlParameter("@begintime", TextBox1.Text));
Params.Add(new SqlParameter("@endtime", TextBox2.Text)); SqlDataAdapter thisAdapter = new SqlDataAdapter(Comm);
/*SqlCommand Comm = new SqlCommand("select * from sto_cc_kc_chart",ThisCon);
SqlDataAdapter thisAdapter = new SqlDataAdapter(Comm);*/
DataTable thisTable = new DataTable();
thisAdapter.Fill(thisTable);
try
{
GridView1.DataSource = thisTable;
GridView1.DataBind();
}
catch (Exception ex)
{ throw; }
SqlCommand Comm = new SqlCommand("prc_jhh_cc_worksatu", ThisCon); Comm.CommandType = CommandType.StoredProcedure;
SqlParameterCollection Params = Comm.Parameters; Params.Add(new SqlParameter("@begintime", TextBox1.Text));
Params.Add(new SqlParameter("@endtime", TextBox2.Text)); SqlDataAdapter thisAdapter = new SqlDataAdapter(Comm);
/*SqlCommand Comm = new SqlCommand("select * from sto_cc_kc_chart",ThisCon);
SqlDataAdapter thisAdapter = new SqlDataAdapter(Comm);*/
DataTable thisTable = new DataTable();
thisAdapter.Fill(thisTable);
try
{
GridView1.DataSource = thisTable;
GridView1.DataBind();
}
catch (Exception ex)
{ throw; }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货