Posted on 2010-08-27
Last Modified: 2012-05-10
I have the following ASP.NET contact page.
The backend is MySql.

When I click submit and look at the data in MySql, it's not what I entered.
Here is what I get:

name: System.Web.UI.HtmlControls.HtmlInputText
email: System.Web.UI.HtmlControls.HtmlInputText
message: System.Web.UI.HtmlControls.HtmlInputText

Please help
using System;

using System.Collections;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;

using MySql.Data.MySqlClient;

using System.Data.SqlClient;

public partial class contact : System.Web.UI.Page


    protected void Page_Load(object sender, EventArgs e)



    protected void image_Click(object sender, EventArgs e)


        MySqlConnection connection = new MySqlConnection("Network Address=localhost;" +

                                                "Initial Catalog='fabrics';" +

                                                "Persist Security Info=no;" +

                                                "User Name='root';" +


        string cmdText = "INSERT INTO tblProducts(name ,email ,message)";

        cmdText += "VALUES(?name ,?email ,?message);";

        MySqlCommand cmd = new MySqlCommand(cmdText, connection);

        cmd.CommandType = CommandType.Text;

        cmd.Parameters.Add("?name", MySqlDbType.VarChar).Value = name.ToString();

        cmd.Parameters.Add("?email", MySqlDbType.VarChar).Value = name.ToString();

        cmd.Parameters.Add("?message", MySqlDbType.VarChar).Value = name.ToString();




            int result = cmd.ExecuteNonQuery();

            lblError.Text = "Data Saved";


        catch (Exception ex)


            lblError.Text = ex.Message;




Open in new window

Question by:Isaac

Accepted Solution

roxviper earned 500 total points
Comment Utility

try name.Value instead

Expert Comment

Comment Utility
u might need to specify size of the varchar while adding the parameters..


Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

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 …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 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

14 Experts available now in Live!

Get 1:1 Help Now