aspx manual adding

Posted on 2009-04-28
Medium Priority
Last Modified: 2012-05-06
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:GridView ID="GridView1" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="priID" HeaderText="priID" SortExpression="priID" />
                <asp:BoundField DataField="tt" HeaderText="tt" SortExpression="tt" />
                No DATA

Open in new window

Question by:tonelm54

Author Comment

ID: 24254676
The data stucture is:-
               'priID' is a varchar(36) - Primary ID
               'tt' is a int(11)
LVL 29

Accepted Solution

David H.H.Lee earned 2000 total points
ID: 24258586
Hi tonelm54,
Try remove the single quotes-@tt inside UpdateCommand property.

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


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question