日期:2014-05-17 浏览次数:20477 次
private void BindGrid()
{
DataSet table = GetDataTable();
Grid1.DataSource = table;
Grid1.DataBind();
}
private DataSet GetDataTable()
{
DataSet source = new DataSet();
DataSet source1, source2;
DataSet source3 = new DataSet();
SqlParameter[] cs4 = new SqlParameter[4];
cs4[0] = new SqlParameter("@kuangchangId", kuangchangId);
cs4[1] = new SqlParameter("@sTime", sTime);
cs4[2] = new SqlParameter("@eTime", eTime);
cs4[3] = new SqlParameter("@customId", customId);
sqlstring = "select id,sellId,printId,productId,productPrice,totalMoney,carId,carMz,carJz,productFs,sellTime from KcSell where kuangchangId=@kuangchangId and checked=1 and customId=@customId and sellTime >= @sTime and sellTime <= @eTIme";
source1 = SqlHelper.ExecuteDataset(SqlHelper.connectionString, CommandType.Text, sqlstring, cs4);
source3.Tables.Add();
source3.Tables[0].Columns.Add("dTime", typeof(string));
source3.Tables[0].Columns.Add("dId", typeof(string));
source3.Tables[0].Columns.Add("dPid", typeof(string));
source3.Tables[0].Columns.Add("productName", typeof(string));
source3.Tables[0].Columns.Add("productPrice", typeof(string));
source3.Tables[0].Columns.Add("carName", typeof(string));
source3.Tables[0].Columns.Add("carMz", typeof(string));
source3.Tables[0].Columns.Add("carJz", typeof(string));
source3.Tables[0].Columns.Add("productFs", typeof(string));
source3.Tables[0].Columns.Add("totalMoney", typeof(string));
source3.Tables[0].Columns.Add("inMoney", typeof(string));
source3.Tables[0].Columns.Add("leaveMoney", typeof(string));
for (int i = 0; i < source1.Tables[0].Rows.Count; i++)
{
DataRow dr = source3.Tables[0].NewRow();
dr[0] = source1.Tables[0].Rows[i][10];