Avatar of logoncom

asked on 

object type system.data.datarowview - No Mapping exists... what does that mean??

I have a sql command that inserts data into a table and a then I show that data in a datagridview.  I can execute the query independently no problem... but something else is messing it up.

Each time I try to insert the data I get an error that I have no idea what it means.

"No mapping exists from object type System.Data.DataRowView to a known managed provider native type."

.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
Bob Learned
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What line of code is causing the problem?
Avatar of logoncom


It fails when it tries to execute the query... on this line " rowCount1 = Sqlinsertboxinfo.ExecuteNonQuery() "

While I was debugging all the data is present but it fails on the execution... even though if I run the same query in SQL 2005 and enter the paramaters in manually... it works.
    Dim weight As Double = CType(TextBox9.Text, Double)  ' lbs
                    Dim tare As Double = CType(TextBox8.Text, Double)  ' lbs
                    Dim samplesize As Integer = ComboBox4.Text  ' #
                    Dim sampleweight As Double = CType(TextBox3.Text, Double) 'oz
                    Dim weightozperpeice As Double = sampleweight / samplesize  ' oz
                    Dim boxqty As Integer
                    Dim counter As Integer = 0
                    Dim boxinsert As Integer = CType(TextBox1.Text, Integer)
                    Do Until counter = CType(TextBox1.Text, Integer)
                        If counter = boxinsert Then Exit Do
                        counter += 1
                        boxqty = (weight - tare) / (weightozperpeice / 16)
                        ' to boxes table
                        Sqlinsertboxinfo.Parameters.AddWithValue("@lognumber", CType(vlognumber, Integer))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@materialnumber", CType(currentmaterialnumber, Integer))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@boxnumber", CType(counter, Integer))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@barcodeidentity", CType(currentmaterialnumber & "-" & counter, String))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@boxqty", CType(boxqty, Integer))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@weight", CType(TextBox9.Text, Decimal))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@tare", CType(TextBox8.Text, Decimal))
                        ' to materials table
                        Sqlinsertboxinfo.Parameters.AddWithValue("@category", ComboBox1.SelectedValue).ToString()
                        Sqlinsertboxinfo.Parameters.AddWithValue("@type", ComboBox2.SelectedValue).ToString()
                        Sqlinsertboxinfo.Parameters.AddWithValue("@size", ComboBox3.SelectedValue).ToString()
                        Sqlinsertboxinfo.Parameters.AddWithValue("@matimage", matimage).ToString()
                        Sqlinsertboxinfo.Parameters.AddWithValue("@comments", TextBox2.Text).ToString()
                        Sqlinsertboxinfo.Parameters.AddWithValue("@boxesingroup", CType(TextBox1.Text, Integer))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@sampleweight", CType(TextBox3.Text, Double))
                        Sqlinsertboxinfo.Parameters.AddWithValue("@samplesize", CType(ComboBox4.Text, Integer))
                        Dim rowCount1 As Integer
                        Dim previousConnectionState2 As ConnectionState
                        previousConnectionState2 = SqlConnection1.State
                            If SqlConnection1.State = ConnectionState.Closed Then
                            End If
                            rowCount1 = Sqlinsertboxinfo.ExecuteNonQuery()
                            If previousConnectionState2 = ConnectionState.Closed Then
                            End If
                        End Try

Open in new window

Avatar of Bob Learned
Bob Learned
Flag of United States of America image

If you take a step back, and look at the process, what is that code meant to do?
Avatar of logoncom


what do you mean?  It's suppose to take all the supplied parameters and insert them into my table.  I have never had this problem before and I am using the same process... so there must be something I am missing.

I was just hoping someone knew what that error code meant so I can find the issue quicker.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo