No mapping exists from object type System.Web.UI.WebControls.

Discussion in 'ASP .Net' started by aarepasky@yahoo.com, May 10, 2006.

  1. Guest

    I am getting the the message on the command:

    cm.ExecuteNonQuery();

    Complete message is:

    No mapping exists from object type System.Web.UI.WebControls.TextBox to
    a known managed provider native type.


    This is with 2005 Express edition of ASP.NET using C#.

    The SQL connection string is:

    "Data Source=kevster\\sqlexpress;Initial Catalog=labbox;Persist
    Security Info=True;User ID=labbox;Password=repasky"

    What do I need to correct this?

    Thanks,
    riprip
    , May 10, 2006
    #1
    1. Advertising

  2. liming Guest

    Seems like it has something to do with the TextBox control. can you post a
    bit more code? Where did you use the TextBox control?

    <> wrote in message
    news:...
    >I am getting the the message on the command:
    >
    > cm.ExecuteNonQuery();
    >
    > Complete message is:
    >
    > No mapping exists from object type System.Web.UI.WebControls.TextBox to
    > a known managed provider native type.
    >
    >
    > This is with 2005 Express edition of ASP.NET using C#.
    >
    > The SQL connection string is:
    >
    > "Data Source=kevster\\sqlexpress;Initial Catalog=labbox;Persist
    > Security Info=True;User ID=labbox;Password=repasky"
    >
    > What do I need to correct this?
    >
    > Thanks,
    > riprip
    >
    liming, May 10, 2006
    #2
    1. Advertising

  3. JohnH Guest

    Sounds like you set the DataBinding on the TextBox itself instead of
    the Text property of the TextBox?

    John H.
    JohnH, May 10, 2006
    #3
  4. ravigoswami

    Joined:
    Mar 26, 2011
    Messages:
    1
    I found the solution. I used the following code which was generating error:
    cmdInsert.Parameters.Add(new SqlParameter("@LastName", txtLastName));
    Instead of
    cmdInsert.Parameters.Add(new SqlParameter("@LastName", txtLastName.Text));

    Silly mistake
    ravigoswami, Mar 26, 2011
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page