aspx manual adding

Im trying to connect aspx to mySQL, although I can get the aspx to display the data, I cannot get it to update the data.

I know I need to write the 'UpdateCommand' manually, but it doesnt seem to work.

Any ideas what Im doing wrong?
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:tonelm2_personalConnectionString %>" 
            DeleteCommand="delete from `test` where `priID` = ?priID" 
            InsertCommand="insert into `test` (`tt`) VALUES ('?tt')" 
            ProviderName="<%$ ConnectionStrings:tonelm2_personalConnectionString.ProviderName %>" 
            SelectCommand="Select `priID`, `tt` from `test`" 
            UpdateCommand="update `test` Set `tt` = '@tt' where `priID` = @priID">
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="priID" HeaderText="priID" SortExpression="priID" />
                <asp:BoundField DataField="tt" HeaderText="tt" SortExpression="tt" />
            </Columns>
            <EmptyDataTemplate>
                No DATA
            </EmptyDataTemplate>
        </asp:GridView>

Open in new window

tonelm54Asked:
Who is Participating?
 
David H.H.LeeCommented:
Hi tonelm54,
Try remove the single quotes-@tt inside UpdateCommand property.
eg:

This line:
     UpdateCommand="update `test` Set `tt` = '@tt' where `priID` = @priID">
       
Change to:
     UpdateCommand="update `test` Set `tt` = @tt where `priID` = @priID">

0
 
tonelm54Author Commented:
The data stucture is:-
               'priID' is a varchar(36) - Primary ID
               'tt' is a int(11)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.