分享

[精]合并查询

 悟静 2013-10-03

 void bindC()
    {
        string sql = "select * from news_class where cparentid=20"
                  + ";select top 10 id,title,dtt from news where titleimg='' and property=1 order by id desc"
                  +";select top 5 id,title,titleImg from news where titleimg<>'' and property=1 order by id desc";


        DataSet ds = DbHelperSQL.Query(sql);
        this.Repeater1.DataSource =ds.Tables[0];
        this.Repeater1.DataBind();

        this.RepeaterTopNews.DataSource = ds.Tables[1];
        this.RepeaterTopNews.DataBind();


        for (int i = 0; i < ds.Tables[2].Rows.Count; i++)
        {
            strpics += ds.Tables[2].Rows[i]["titleimg"];
            if (i < 4) {strpics += "|"; }
            strlinks += "news_shows.aspx?Nid=" + ds.Tables[2].Rows[i]["id"] + "|";
            strtitles += ds.Tables[2].Rows[i]["title"] + "|";
        }

        //this.Repeater2.DataSource = ds.Tables[2];
        //this.Repeater2.DataBind();
        //this.DataListimg.DataSource = DbHelperSQL.Query("select top 5 id,title,titleimg from news where titleimg<>'' order by id desc");
        //this.DataListimg.DataBind();
    }

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多