yuezhonghu

悠然现南山...
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

调用控件的函数

Posted on 2008-01-14 16:56  .狐狸血.  阅读(163)  评论(0编辑  收藏  举报

txt_CustomerSingle_S_TextChanged(txt_CustomerSingle_S, new EventArgs());

 

txt_CustomerSingle_S:控件名称

new EventArgs() : 基础事件类

    /// <summary>
    /// 模糊筛选发件人
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void txt_CustomerSingle_S_TextChanged(object sender, EventArgs e)
    {
        string SQL = "SELECT * FROM wl_client_info WHERE del_c=1 and Number_C like @Number_C";
        SqlParameter[] parameter ={
            new SqlParameter("@Number_C",SqlDbType.VarChar,50)
        };
        parameter[0].Value = "%" + txt_CustomerSingle_S.Text.Trim() + "%";
        DataSet DS = new DataSet();
        try
        {
            DS = LiTianPing.SQLServerDAL.DbHelperSQL.Query(SQL, parameter);
            DataTable DT = DS.Tables[0];
            if (DT.Rows.Count > 0)
            {
                txt_CommiessMan_S.Text = DT.Rows[0]["LinkMan_C"].ToString();
                txt_CommiessUnit_S.Text = DT.Rows[0]["Name_C"].ToString();
                txt_CommiessAddress_S.Text = DT.Rows[0]["Addre_C"].ToString();
                txt_CommiessTel_S.Text = DT.Rows[0]["Phone_C"].ToString();
                txt_Com_Postalcode_S.Text = "";// DT.Rows[0]["Com_Postalcode_S"].ToString();
                txt_CustomerSingle_S.Text = DT.Rows[0]["Number_C"].ToString();
            }
        }
        catch (Exception e1)
        {
 
        }

    }