Beispiel #1
0
    public void chengqu()
    {
        linqChengQuDataContext cq          = new linqChengQuDataContext();
        Table <ChengQu>        chengqulist = cq.GetTable <ChengQu>();
        var query =
            from chengqu in chengqulist
            select chengqu;

        drlCQ.DataSource     = query;
        drlCQ.DataTextField  = "Cq_Name";
        drlCQ.DataValueField = "Cq_Id";
        drlCQ.DataBind();
        drlCQ.SelectedIndex = 0;
    }
Beispiel #2
0
    public void bangding()
    {
        linqChengQuDataContext cq     = new linqChengQuDataContext();
        Table <ChengQu>        cqlist = cq.GetTable <ChengQu>();
        //读取数据库城区表信息
        var query =
            from chengqu in cqlist
            select cq;

        //设置grvCQ数据源为query
        grvCQ.DataSource = query;
        //设置grvCQ标识码为CQ_Id
        grvCQ.DataKeyNames = new string[] { "Cq_Id" };
        //执行grvCQ数据绑定
        grvCQ.DataBind();
    }