如何填写gridview

时间:2013-06-19 14:29:26

标签: c# asp.net gridview

我正在尝试填写此gridview:

<asp:GridView ID="gvReportingStockComp" runat="server">

<Columns>

<asp:BoundField DataField="cod_wo" HeaderText="N° OF" />
<asp:BoundField DataField="composant" HeaderText="Composant" />
<asp:BoundField DataField="besoin" HeaderText="Besoin/OF" />

</Columns>

</asp:GridView>

使用C#后面的代码,但我不知道什么不适合它:

OracleConnection oConnexion = new OracleConnection();
oConnexion.ConnectionString = "X";
oConnexion.Open();

string requete = SELECT cod_wo, composant, ROUND((wo_qty / (qty_revue * qte_besoin)) - qte_assignee,2) \"BESOIN\" FROM w";

OracleCommand cmdReqStockComp = new OracleCommand(requete);
cmdReqStockComp.Connection = oConnexion;
OracleDataReader readerReqStockComp = cmdReqStockComp.ExecuteReader();

gvReportingStockComp.DataSource = readerReqStockComp;
gvReportingStockComp.DataBind();

oConnexion.Close();
oConnexion.Dispose();

Bizarre

1 个答案:

答案 0 :(得分:0)

requete需要引用。

string requete = "SELECT cod_wo, composant, ROUND((wo_qty / (qty_revue * qte_besoin)) - qte_assignee,2) \"BESOIN\" FROM w";