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

A

aarepasky

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
 
L

liming

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?
 
J

JohnH

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

John H.
 
Joined
Mar 26, 2011
Messages
1
Reaction score
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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top