Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3787230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:48:29+00:00 2026-05-19T11:48:29+00:00

I am trying to link my asp.net Formview to a MySQL database, but with

  • 0

I am trying to link my asp.net Formview to a MySQL database, but with no success.

Take a look at my code and please tell my where is my mistake:

<asp:FormView ID="FormView1" runat="server" DataKeyNames="ImageID" 
        DataSourceID="SqlDataSource1" EnableModelValidation="True">
        <EditItemTemplate>
            ImageID:
            <asp:Label ID="ImageIDLabel1" runat="server" Text='<%# Eval("ImageID") %>' />
            <br />
            Title:
            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            Description:
            <asp:TextBox ID="DescriptionTextBox" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <InsertItemTemplate>
            Title:
            <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            Description:
            <asp:TextBox ID="DescriptionTextBox" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>
        <ItemTemplate>
            ImageID:
            <asp:Label ID="ImageIDLabel" runat="server" Text='<%# Eval("ImageID") %>' />
            <br />
            Title:
            <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
            <br />
            Description:
            <asp:Label ID="DescriptionLabel" runat="server" 
                Text='<%# Bind("Description") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
        </ItemTemplate>
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:cmsConnectionString %>" 
        InsertCommand="INSERT INTO [tbimages] ([ImageID], [Title], [Description]) VALUES (ImageID, Title, Description)" 
        ProviderName="<%$ ConnectionStrings:cmsConnectionString.ProviderName %>" 
        SelectCommand="SELECT ImageID, Title, Description FROM tbimages" 
        UpdateCommand="UPDATE [tbimages] SET [Title] = ?, [Description] = ? WHERE [ImageID] = ?">

        <InsertParameters>
            <asp:Parameter Name="ImageID" Type="Int64" />
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="ImageID" Type="Int64" />
        </UpdateParameters>
    </asp:SqlDataSource>

i already define my connection string in the web config :

    <connectionStrings>
    <add name="cmsConnectionString" connectionString="server=localhost;User Id=root;password=123;database=cms" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>

Please if you have any idea to solve this let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:48:30+00:00Added an answer on May 19, 2026 at 11:48 am

    You might want to change the Insert Command like so

    InsertCommand="INSERT INTO [tbimages] ([ImageID], [Title], [Description]) VALUES (? , ? , ?)"
    

    UPDATED :

    InsertCommand="INSERT INTO [tbimages] ([ImageID], [Title], [Description]) 
     VALUES (?ImageID , ?Title , ?Description)"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add control to the ASP.NET page. Controls are added successfully but
I'm trying to add Fancybox to my ASP.NET MVC application but I'm having some
Link I'm using ASP.NET with C# and trying to use linq to sql to
In ASP.NET MVC, I'm trying to create a link that includes an anchor tag
I am trying to use jGrowl in ASP.NET, but am getting a Microsoft JScript
I am using ASP.NET 4 and MVC and trying to add code to handle
I am following the link http://geekswithblogs.net/frankw/archive/2008/05/18/forms-authentication-with-active-directory-in-asp.net-2.0.aspx Trying to implement the same in my application.I
I've a asp.net linkbutton inside asp.net repeater control which renders multiple link buttons. I
I am trying connect the asp.net membership tables in to an asp.mvc 3 website.
I am trying to understand different events in a Asp.net page life cycle. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.