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

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

  1. aarepasky

    aarepasky 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
     
    aarepasky, May 10, 2006
    #1
    1. Advertisements

  2. aarepasky

    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?
     
    liming, May 10, 2006
    #2
    1. Advertisements

  3. aarepasky

    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. aarepasky

    ravigoswami

    Joined:
    Mar 26, 2011
    Messages:
    1
    Likes Received:
    0
    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. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.