aspx manual adding

Posted on 2009-04-28
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

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

    Accepted Solution

    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">


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now