Print Page | Close Window

Update error

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4378
Printed Date: 21-Aug-2025 at 6:38pm


Topic: Update error
Posted By: Togas
Subject: Update error
Date Posted: 26-Sep-2013 at 6:10am
I have this code which updates my entity any time a field changes:


    Private Sub SaveOrderFromTracking(field As String)
      field = field.Remove(0, 24)
      Dim oldVal As String = CStr(SelectedOrder.EntityAspect.GetValue(field, EntityVersion.Current))
      Dim newVal As String = CStr(SelectedOrder.EntityAspect.GetValue(field))
      Dim OrderId As String = SelectedOrder.EntityAspect.GetValue("OrderId")

      If oldVal = newVal Then Exit Sub

      _mgr.SaveChangesAsync({SelectedOrder}, Nothing, Sub(args)
                                                        If Not args.HasError Then
                                                          Dim newMessage As Message = New Message(OrderId, MsgType.FieldChange, field, oldVal, newVal)
                                                          Messages.Insert(0, newMessage)
                                                        Else
                                                          MessageBox.Show(args.Error.Message)
                                                        End If
                                                      End Sub)
    End Sub


This was working but I added a new field to the table, now I get this error.

The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns.

I ran a tracer on my SQL server and this is the TSQL being generated:

exec sp_executesql N'update [dbo].[Fastenal_Order]
set [Serial] = @0
where ([OrderId] = @1)
',N'@0 varchar(50),@1 int',@0='test23',@1=1447


Any thoughts on what's going on?



Replies:
Posted By: Togas
Date Posted: 26-Sep-2013 at 6:27am
So dumb!

There was a trigger on the table, it was using an asterisk.

 





Print Page | Close Window