Click here to Skip to main content
15,612,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,

I am getting the the message on the command:

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

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

The SQL connection string is:
Data Source=RMM-PC-343\SQLEXPRESS1;Initial Catalog=Student_Result;Integrated Security=True;

What do I need to correct this?

Zaid Qureshi
Updated 27-Sep-12 23:33pm
Abhijit Parab 28-Sep-12 5:34am    
It would be better if you provide some code for given problem

1 solution

Most of the times the reason behind this error is passing object instead of specific value of that object.

For example, based on the line of error, you might have prepared a SQL query with parameters. While assigning values to those parameters, if you assign the textbox directly (instead of textbox Text), above error will occur.

So, try:
cmd.Parameters.AddWithValue("@someParam", TextBox1.Text)

Check and try!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900