c# - Can I use the update statement with the select statement together in an SqlDataSource? -


my query looks this:

<asp:sqldatasource id="updatefullnamesql" runat="server" connectionstring="<%$ connectionstrings:userqueries %>" providername="<%$ connectionstrings:userqueries.providername %>"          updatecommand="update users set firstname = :changefirstname, lastname = :changelastname username = :currentusername">         <updateparameters>             <asp:controlparameter controlid="changefirstnamebox" name="changefirstname" propertyname="text" type="empty" />             <asp:controlparameter controlid="changelastnamebox" name="changelastname" propertyname="text" type="empty" />         </updateparameters>         <selectparameters>             <asp:controlparameter controlid="usernamebox" name="currentusername" propertyname="text" type="empty" />         </selectparameters>     </asp:sqldatasource> 

so have 2 parameters want update , 1 parameter want use change data matches withthe selectparameter's data. , when want execute it, shows ora-01008 exception. code-behind has updatefullnamesql.update(); function.

what missing here/doing wrong?

in update command should use @ instead of :. i.e.:

updatecommand="update users set firstname = @changefirstname,    lastname = @changelastname username = @currentusername;" 

additionally have specify @currentusername update parameter

<updateparameters>   ...   <asp:controlparameter controlid="usernamebox"      name="currentusername" propertyname="text" type="empty" /> </updateparameters> 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -