Example #1
0
    private void company(string sname)
    {
        string sql = "SELECT  [ID] ,[Name] FROM  [dbo].[Company] where state=1 ";

        if (Session["title"].ToString() != "3" && Session["title"].ToString() != "5")
        {
            sql += " and UserID='" + Session["userid"] + "' ";
        }
        if (sname.Length > 0)
        {
            sql += " and [Name] like '%" + sname + "%' ";
        }

        DataTable dt = DBqiye.getDataTable(sql);

        ChiYouRenID.Items.Clear();
        ChiYouRenID.DataSource     = dt;
        ChiYouRenID.DataTextField  = "Name";
        ChiYouRenID.DataValueField = "ID";
        ChiYouRenID.DataBind();
        ChiYouRenID.Items.Insert(0, new ListItem("==请选择==", ""));
        ChiYouRenID.SelectedValue = "";
    }
Example #2
0
    private void person(string str)
    {
        //string sql = "SELECT id,CName FROM [dbo].[ResultRen] where state=1 ";
        string sql = "SELECT   [id]      ,[zjname] FROM  [dbo].[zqhl_zj] ";

        //if (Session["title"].ToString() != "3")
        //{
        //    sql += " and UserID='" + Session["userid"] + "' ";
        //}
        if (str.Trim().Length > 0)
        {
            sql += " where  [zjname] like '%" + str + "%' ";
        }
        sql += " order by zjname";
        DataTable dt = DBC.getDataTable(sql);

        ChiYouRenID.DataSource     = dt;
        ChiYouRenID.DataTextField  = "zjname";
        ChiYouRenID.DataValueField = "ID";
        ChiYouRenID.DataBind();
        ChiYouRenID.Items.Insert(0, new ListItem("==请选择==", ""));
        ChiYouRenID.SelectedValue = "";
    }