Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 用户如何回复帖子_C#_Asp.net_Asp.net Ajax - Fatal编程技术网

C# 用户如何回复帖子

C# 用户如何回复帖子,c#,asp.net,asp.net-ajax,C#,Asp.net,Asp.net Ajax,页面:1 questionview.aspx.cs背后的代码 protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("server=SARFARAZ\\SQLEXPRESS; Integrated Security=true; database=tdf;"); SqlDataAdapter sqlcmd1

页面:1 questionview.aspx.cs背后的代码

     protected void Page_Load(object sender, EventArgs e)
        {


        SqlConnection con = new SqlConnection("server=SARFARAZ\\SQLEXPRESS; Integrated Security=true; database=tdf;");
        SqlDataAdapter sqlcmd1 = new SqlDataAdapter("SELECT * from question, users where  users.user_id=question.user_id AND question_id='" + Request.QueryString["qid"] + "'", con);
        DataTable dt = new DataTable();
        sqlcmd1.Fill(dt);
        Repeater1.DataSource = dt;
        Repeater1.DataBind();
    }
第2页:Questionview.aspx

通过转发器我可以显示我的帖子和回复,但它不能显示。。! asp.net代码:

<asp:Repeater ID="Repeater1" runat="server">
  <HeaderTemplate>
        <div class="container">
    </HeaderTemplate>
    <ItemTemplate>
       <div class="panel panel-primary">
           <div  class="panel-heading">

               <h2 class="panel-title"><a href="Answer.aspx?qid=<%#Eval("question_id") %>"><asp:Label ID="Label2" runat="server" Text="Reply"></asp:Label></a></h2>
          </div><!--panel-heading-->
           <div class="panel-body">
               <h3><asp:Label ID="Label5" runat="server" Text='<%#Eval("heading") %>'></asp:Label></h3>
                   <asp:Image ID="Image1" runat="server" ImageUrl='<%#Eval("uimg")%>' Height="100" Width="100" />
               <asp:Label ID="Label1" runat="server" Text='<%#Eval("question_detail") %>'></asp:Label>
               <br />
               <asp:Label ID="Label4" runat="server" Text='<%#Eval("username") %>'></asp:Label>
               <br />
                 <asp:Label ID="Label3" runat="server" Text='<%#Eval("datetimes") %>'></asp:Label>
        </div><!--panel-heading-->
    </ItemTemplate>
</asp:Repeater>

. 现在maker是一个问题,我想回答maker问题的答案


单击maker question后,用户将转到maker question maker,然后您还可以在计算机屏幕上观看问题的显示方式。简单地说,希望用户来回答问题,我正在制作论坛项目。

问题不清楚-尝试添加解释首先,您使用的是2
SQL select
查询,不确定原因,您没有将任何内容绑定到repeater,例如
Repeater1.DataSource=ds
。为什么要将值赋给
sdpt.SelectCommand
两次?请再次查看。我正在更新问题。。。!谢谢,不过你听说过SQL注入吗?你的代码太不安全了:question_id='“+Request.QueryString[“qid”]请关闭这个缺口:)