Error updating sql DB from dataset

Posted on 2012-09-07
Last Modified: 2012-09-11
Hi Experts,

I have the following error message:
Data.SqlClient.SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 23 ("@p21"): The supplied value is not a valid instance of data type real. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision.
   at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)

How can I get the name and/or value of parameter 23 to troubleshoot this? DataSet is filled as follows
 Dim strSQLReports As String = "SELECT * FROM Reports"
daSQLReports = New SqlDataAdapter(strSQLReports, SQLConn)
cbSQLReports = New SqlCommandBuilder(daSQLReports)

daSQLReports.FillSchema(dsSQL, SchemaType.Source, "Reports")
daSQLReports.Fill(dsSQL, "SQLReports")

The error occurs on the following

Thanks in advance,
Question by:mark_norge
    LVL 49

    Expert Comment

    by:Julian Hansen
    Are you reading from Reports and Writing to SQLReports?

    If so the error is saying that there is a type mismatch between the two

    Check the field defs between the two tables and make sure the types match exactly.

    for instance if one is decimal and the other is a float it could cause this error.
    LVL 49

    Expert Comment

    by:Julian Hansen
    Also you might consider asking to have this question moved to the VB.Net / .Net / SQL Server groups it does not belong in CSS

    Author Comment

    Hi Julian,

    Do you know however how to find out what the fieldname and value are of parameter 23?

    This would narrow down the troubleshooting.

    Thanks, Mark
    LVL 49

    Accepted Solution

    You did not answer my question regarding whether you were copy from Reports table to a differerent SQLReports table - but will assume the answer is yes.

    In which case I would look at the table def for each and look at field 23 to see how that is defined.

    Author Closing Comment

    Hi Julian,

    Indeed the answer was yes and you where correct in your first reply. Took time to find what caused it. Thanks for the help. MB
    LVL 49

    Expert Comment

    by:Julian Hansen
    You are welcome. Thanks for the points.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now