sql = "Select sum(stockprice*inventory) as amount FROM productlist where inventory>0";
People.DataSource = CreateDataSource();
People.DataBind();
这是绑定的一个值,我想叫它在页面输出来,用什么控件最好,最好能写出用法
People代表datagrid的id

解决方案 »

  1.   

    就这么一个值用Label就行了:Lable1.Text=值
      

  2.   

    那具体用datagrid的什么呢??
      

  3.   

    楼主什么意思,你不是已经用datagrid了吗
      

  4.   

    恩,就用<asp:datagrid runat="server" id="people">…………</asp:datagrid>
      

  5.   

    1,datagrid可以显示,适合多列数据
    2,datalist可以,如果就一列数据可以用这个,效率高些
      

  6.   

    use datareader to get the value,and use labe to view it on the web.
      

  7.   

    sql = "Select sum(stockprice*inventory) as amount FROM productlist where inventory>0";
    People1.DataSource = CreateDataSource();
    People1.DataBind();<asp:DataGrid id="People1" runat="server"
    >
    <asp:Label 
    Width="30" 
    Text='<%# DataBinder.Eval(Container.DataItem, "amount").ToString().Trim() %>' 
    runat="server"/></asp:DataGrid>
    我这样写还是不对,各为帮我看看错在哪里了??我想要的就是把amount的值在页面输出出来就可以了