Forums - C# Corner

Forum guidelines
Dan

Dan

  • 0
  • 0
  • 0

No mapping exists

Apr 1 2008 8:14 PM

I have a contact form submitting data to a sql 2005 table on a Win2003 server. The form takes the textbox data and saves it in session variables, then tries to insert these into the table. I can post the rest of the code if necessary. The stack and error are listed below. Am I getting this error because the data needs converted to an integer somewhere? Im clueless as to why this is coming up. If anyone can suggest something I would gladly appreciate the advice. Thank you in advance.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: No mapping exists from object type System.Web.UI.WebControls.Label to a known managed provider native type.

Source Error:

 
Line 82:
Line 83: sqlCmd.Connection = sqlConn;
Line 84: SqlDataReader sqlRdr = sqlCmd.ExecuteReader();
Line 85: }
Line 86: catch (SqlException ex)

Stack Trace:

 
[ArgumentException: No mapping exists from object type System.Web.UI.WebControls.Label to a known managed provider native type.]
 System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen) +1329
System.Data.SqlClient.SqlParameter.GetMetaTypeOnly() +774328
System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc) +14
System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters) +166
System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc) +253
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteReader() +84
DollRegistration.VerifyItemRegistration(Object sender, EventArgs e) in d:\Inetpub\testroot\DollRegistration2.aspx.cs:84
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

Answers (3)

C# Corner Hyderabad Developer Conference

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.