1: asp.net中的DataReader和asp中的Recordset工作原理 是不是一样的.我能用DataRead分页不?DataGrid---datalist等,它们的工作原理是不是都一样只不过把有的功能"模板化"了?我觉得用DataGrid与DataList增加我爱鸡的负担,我不想用它们,如果能用DataRead分页的话要怎么分?2: 还有怎么样才能让没有恶意的html在显示的时候生效?如<img src="XXX.gif">我在页面中设VlidateReuest="false"然后把输入的html进行编码了
显示的时候却回不了原了像上边的html我想起用啊!!!!!还一个网址后边参数的问题如:PostNew.asp?room=5202 如果我在后边加了 and XX=XX  或"符号要引发异常,那我我想处理它,用try{}catch{}或(做了一个数据显示类DataBind()不返回真, 要不就返回假)
if(DataBind){不处理}else{不处理}行不, 这样能不能让它像csdn一样还是显示这一页不显示其它的,
如果我做的不对那么csdn是怎么做的啊, 我想像csdn一样加了什么都还是显示这一页, 怎么做啊
3: 还有一个论坛分类的问题有两种做法一: 加一个分类加一个表要二: 加一个论坛分类不加表在发言时加入这个分类的标识显示数据的时候在筛选,我认为二这样没有加个分类就加个文章表快因为所有文章都要放在一起显示的时候要筛选,而有一个分类就有一个表不会, 是不是要快点? 这样好不
大侠们帮我啊, 我才学了一周, 不够用啊!!

解决方案 »

  1.   

    这些在论坛里很多,搜一下,找本asp.net的书看一下,就明白了。
      

  2.   

    学程序一定不能浮躁.
    DataGrid与DataList增加我爱鸡的负担. --->你有没有测试过?就算有,也是体现不出来的.
    你也可以用DataTable来分页
    后面的我的语文水平不过关?请写明白点.
      

  3.   

    搂主,找对人了,我正在用repeater进行分页! DataGrid分页的办法是什么?还不是用PagedDataSource类,其实在repeater中一样可以运用该类进行分页的。给你点我现成的代码:
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Repeater RepeaterBind;
    protected System.Web.UI.WebControls.Label lblCurPage;
    protected System.Web.UI.WebControls.HyperLink LnkPrev;
    protected System.Web.UI.WebControls.HyperLink LnkNext;
    public static string ConnectionString="Data Source=GPTEACHER;database=NorthWind;uid=sa;pwd=sa;"; private void RepeaterDataBind()
    {
    SqlConnection conn=new SqlConnection(ConnectionString);
    SqlDataAdapter da=new SqlDataAdapter("select CustomerID,CompanyName,Country from Customers",conn);
    DataSet ds=new DataSet();
    try
    {
    da.Fill(ds," Customers");
    //创建分页类
    PagedDataSource objPage=new PagedDataSource();
    //设置数据源
    objPage.DataSource=ds.Tables["Customers"].DefaultView;
    //允许分页
    objPage.AllowPaging=true;
    //设置每页显示的项数
    objPage.PageSize=10;
    //定义变量用来保存当前索引
    int CurPage;
    if(Request.QueryString["Page"]!=null)
    CurPage=Convert.ToInt32(Request.QueryString["Page"]);
    else CurPage=1;
    objPage.CurrentPageIndex=CurPage-1;
    lblCurPage.Text="当前页:第"+CurPage.ToString()+"页";
    if(!objPage.IsFirstPage)
    LnkPrev.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(CurPage-1);
    if(!objPage.IsLastPage)
    LnkNext.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(CurPage+1);

    RepeaterBind.DataSource=
    RepeaterBind.DataBind();
    }
    catch(Exception)
    {
    //Response.Write(error.ToString());
    Response.Write("数据库访问出错");
    }
    }

    private void Page_Load(object sender, System.EventArgs e)
    {
    if(!IsPostBack)
    RepeaterDataBind();
    // Put user code to initialize the page here
    } #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion
    }
    }
      

  4.   

    DataReader?看错了,我以为你用DataRepeater呢,不过,原理一样的!
    你看看吧
      

  5.   

    DataReader和Repeater一样?我晕...-_-