asp.net - incorrect syntax near nvarchar in gridview -


i have problem updating column of gridview; when try update field error:

incorrect syntax near 'nvarchar'.
must declare scalar variable "@pid".

here piece of code:

<asp:gridview id="gridview1" runat="server"  name="gd"  height="100px"              width="435px" autogeneratecolumns="false" datakeynames="pid" datasourceid="sqldatasource1" >     <columns>         <asp:commandfield showeditbutton="true" showselectbutton="true" />         <asp:boundfield datafield="pid" headertext="pid"                      sortexpression="pid" readonly="true" />         <asp:boundfield datafield="name" headertext="name"                      sortexpression="name" />         <asp:boundfield datafield="hoghoghe rozane" headertext="hoghoghe rozane"                      sortexpression="hoghoghe rozane" />         <asp:boundfield datafield="paye" headertext="paye"                      sortexpression="paye" />     <\columns> <asp:gridview> <asp:sqldatasource id="sqldatasource1" runat="server"               connectionstring="<%$ connectionstrings:connectionstring %>"    updatecommand="update [post] set [name] = @name, hoghoghe_rozane = @hoghoghe_rozane, [paye] = @paye (pid = @pid)" >         <updateparameters>          <asp:parameter name="name" type="string" />          <asp:parameter name="hoghoghe_rozane" type="int32" />          <asp:parameter name="paye" type="int32" />            <asp:parameter name="pid" type="string" />      </updateparameters>  </asp:sqldatasource> 

chek out : same problem

it says must change [hoghoghe rozane] [hoghoghe_rozane]

update :::

1.make sure type of pid field in database 2.fields should not have spaces in tables 3.alias should not have spaces too

try code :

<asp:gridview id="gridview1" runat="server"  name="gd"  height="100px"          width="435px" autogeneratecolumns="false" datakeynames="pid" datasourceid="sqldatasource1" > <columns>     <asp:commandfield showeditbutton="true" showselectbutton="true" />     <asp:boundfield datafield="pid" headertext="pid"                  sortexpression="pid" readonly="true" />     <asp:boundfield datafield="name" headertext="name"                  sortexpression="name" />     <asp:boundfield datafield="hoghoghe_rozane" headertext="hoghogherozane"                  sortexpression="hoghoghe_rozane" />     <asp:boundfield datafield="paye" headertext="paye"                  sortexpression="paye" /> <\columns> 

connectionstring="<%$ connectionstrings:connectionstring %>"  updatecommand="update [post] set [name] = @name, hoghoghe_rozane = @hoghoghe_rozane, [paye] = @paye (pid = @pid)" >     <updateparameters>      <asp:parameter name="name" type="string" />      <asp:parameter name="hoghoghe_rozane" type="int32" />      <asp:parameter name="paye" type="int32" />        <asp:parameter name="pid" type="string" />  </updateparameters> 

hope work.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -