Пример #1
0
    public static void queryDscweek(object sender)
    {
        try
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            List <System.Web.UI.WebControls.ListItem> listItem = new List <System.Web.UI.WebControls.ListItem>();

            string strSql = "Select b.doc_code, b.emp_name From dscdocm b Inner Join dscweek a On a.emp_id=b.emp_id Where p_yymm=? And shift_no='A13'";
            System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(strSql);
            cmd.Parameters.Add("@Param1", System.Data.Odbc.OdbcType.Char).Value = DateTime.Now.ToString("yyyyMM");
            //cmd.Parameters.Add("@Param2", System.Data.Odbc.OdbcType.Char).Value = DateTime.Now.ToString("yyyyMM");
            Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();
            dt = conn.GetData(cmd);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listItem.Add(new System.Web.UI.WebControls.ListItem(dt.Rows[i]["doc_code"].ToString().Trim() + " " + dt.Rows[i]["emp_name"].ToString().Trim(), dt.Rows[i]["doc_code"].ToString().Trim()));
                }

                ((System.Web.UI.WebControls.DropDownList)sender).Items.AddRange(listItem.ToArray());
                ((System.Web.UI.WebControls.DropDownList)sender).DataBind();
            }
        }
        catch (Exception ex)
        {
            PublicLib.handleError("", "PublicLib", ex.Message);
        }
    }
Пример #2
0
    public static void queryCodeFile(object sender, string strType, string strParam)
    {
        try
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            List <System.Web.UI.WebControls.ListItem> listItem = new List <System.Web.UI.WebControls.ListItem>();

            string strSql = "Select item_code, description From code_file Where check_flag='Y' And item_type=?" + strParam;
            System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(strSql);
            cmd.Parameters.Add("@Param", System.Data.Odbc.OdbcType.Char).Value = strType;
            Dev.ODBCSql.MyODBCConnection conn = new Dev.ODBCSql.MyODBCConnection();
            dt = conn.GetData(cmd);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listItem.Add(new System.Web.UI.WebControls.ListItem(dt.Rows[i]["item_code"].ToString().Trim() + " " + dt.Rows[i]["description"].ToString().Trim(), dt.Rows[i]["item_code"].ToString().Trim()));
                }

                ((System.Web.UI.WebControls.DropDownList)sender).Items.AddRange(listItem.ToArray());
                ((System.Web.UI.WebControls.DropDownList)sender).DataBind();
            }
        }
        catch (Exception ex)
        {
            PublicLib.handleError("", "PublicLib", ex.Message);
        }
    }