2 stronglc stronglc 于 2013.07.16 13:38 提问

要求查到 WORKERID OUTTIME INTIME GOTIME这几个数据
c#

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class V4_Admin_SystemSet_Other_KQ_BM4 : BasePage4
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitData();
}
}

}

protected void InitData()
{ DateTime db = DateTime.Parse(DateTime.Now.Year + "-" + DateTime.Now.Month + "-01");
txtDate.Value = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
}

protected void BindData()
{
    DateTime date = DateTime.MinValue;

    if (txtDate.Value == string.Empty)
    {
        CommonMethod.Alert(this, "日期不能为空");
        return;
    }

    if (!DateTime.TryParse(txtDate.Value, out date))
    {
        CommonMethod.Alert(this, "日期填写不正确");
        return;
    }

    string sql = "exec CreateKQ4 '" + date.ToString("yyyy-MM-dd") + "','" + id + "'";
    string constr = Maticsoft.DBUtility.DbHelperSQLM.GetConnstr("ykt");
    DataTable dt = Maticsoft.DBUtility.DbHelperSQLM.Query(constr, sql).Tables[0];


    string sql= "SELECT a.[WorkerID],[WorkerName],c.DepName,b.ID,b.Name,a.[healthyNo]"
       + " FROM [CorpWorker] a "
       + " left join Rank b on a.[WorkerRank] = b.ID"
       + " where a.[WorkerID] = '" + id + "'";

    DataTable dt1 = Maticsoft.DBUtility.DbHelperSQLM.Query(constr, sql1).Tables[0];
    string hn = CommonMethod.GetFinalString(dt1.Rows[0]["healthyNo"]);
    lbDept.Text = CommonMethod.GetFinalString(dt1.Rows[0]["DepName"]) + CommonMethod.GetFinalString(dt1.Rows[0]["Name"]);
    lbName.Text = CommonMethod.GetFinalString(dt1.Rows[0]["WorkerName"]);


    exportDt = new DataTable();
    exportDt = dt;

    rptList.DataSource = dt;
    rptList.DataBind();
}



//查询 事件
protected void btnSearch_Click(object sender, EventArgs e)
{
    BindData();
}
}

要怎么改,补充点什么

Csdn user default icon
上传中...
上传图片
插入图片