Parameter must be defined (mysql - visual c#)
Posted by: marc-antoine yonga
Date: March 13, 2017 09:47AM

Hello,

I encounter an error about parameter '@Rownum' must be defined and I don't see where does the error occur ?

Could you help me ?

the code is :
_ page html :
<asp:GridView ID="GV_ListeAnnonces" runat="server" AutoGenerateColumns="false" OnRowCommand="OnRowCommand" GridLines="None">
<Columns>
<asp:BoundField DataField="@Rownum" HeaderText="Numéro" />
<asp:BoundField DataField="T_JP_Annonce_Image" HeaderText="Image" Visible="false"/>
<asp:BoundField DataField="T_JP_Annonce_DtimeCreation" HeaderText="Date" />


_ page MySQL - visual c# :
SqlDataSource1.SelectParameters.Clear();
SqlDataSource1.SelectCommand = "SELECT @Rownum, T_JP_Annonce_Image, T_JP_Annonce_DtimeCreation FROM (SELECT @Rownum:=0) bat, t_jp_annonce WHERE T_JP_Annonce_fk_Jobers_Pseudo= ?Pseudo0 HAVING (@Rownum:=@Rownum+1) BETWEEN (CONVERT(?PageIndex, SIGNED INTEGER)*CONVERT(?PageSize, SIGNED INTEGER)) AND ((CONVERT(?PageIndex, SIGNED INTEGER)+1)*CONVERT(?PageSize, SIGNED INTEGER))";
SqlDataSource1.SelectParameters.Add("?Pseudo0", Session["UserNameSession"].ToString());
SqlDataSource1.SelectParameters.Add("?PageIndex", indexPage);
SqlDataSource1.SelectParameters.Add("?PageSize", StringNbLignesPage);
GV_ListeAnnonces.DataSource = SqlDataSource1;
GV_ListeAnnonces.DataBind();
SqlDataSource1.Dispose();

Options: ReplyQuote


Subject
Written By
Posted
Parameter must be defined (mysql - visual c#)
March 13, 2017 09:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.