.aspx中的代码 ,where 语句后面的值需要从session或.cs的变量中读取...具体格式怎么样...谢谢!   <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:conn %>" 
        
        SelectCommand="SELECT [units], [application_t], [st], [sa], [ea], [number], [model], [task], [status] FROM [application_v] where uid = ....">
    </asp:SqlDataSource>

解决方案 »

  1.   


    <%= Session["yourname"] %>
      

  2.   

    SelectCommand="SELECT [units], [application_t], [st], [sa], [ea], [number], [model], [task], [status] FROM [application_v] where uid = <%= Session["yourname"] %>">
    ---------
    报错:如果用引号将此属性值括起来,则必须成对使用引号.
      

  3.   

     where uid = '"  + Session["yourname"]  +"'
    试试,还真没用 过asp:SqlDataSource 
      

  4.   

    "SELECT  FROM [application_v] where uid ="+Session["name"].tostring()
      

  5.   

    <asp:sqldatasource
              id="SqlDataSource1"
              runat="server"
              connectionstring="<%$ ConnectionStrings:MyNorthwind %>"
              selectcommand="SELECT LastName FROM Employees WHERE Title = @Title">
              <selectparameters>
                  <asp:SessionParameter Name="Title" SessionField="userID" />
              </selectparameters>
          </asp:sqldatasource>是这样用的
      

  6.   

    1.。你的SESSION既然取到了!那么在后台用方法把ID的值取到!然后传参!
    我发现你的传参的思想都不对!哪有用SqlDataSource 这样写的啊!