locked
invalid operation RRS feed

  • Question

  • Hello

    I have this code to check if a matching record exists. If not I add one.

    Dim c As Integer
                c = Me.WetVegTableAdapter.CountForID(vID)
                If c <> 0 Then
                    'found a record, so fill by id
                    Me.WetVegTableAdapter.FillByID2(Me.WFPDAAGC302DataSet.WetVeg, vID)
                Else
                    'did not find record so insert a related record
                    Me.WetVegTableAdapter.InsertByID(vID)
                    Me.WetVegTableAdapter.Update(Me.WFPDAAGC302DataSet.WetVeg)

                End If

    Why would I get an invalid operation on this line of code?

    c = Me.WetVegTableAdapter.CountForID(vID)

    Thanks
    Tuesday, May 12, 2009 3:10 PM

Answers

  • I am sorry. It was a stupid mistake on my part. Syntax error! Thanks so much for your help and sorry to waste your time.

    Ryan
    Wednesday, May 13, 2009 1:35 PM

All replies

  • Hi,

    Do you have any call stack information? Even though the error is being shown at this line, the call stack will provide you with more information.

    Thanks

    Paul Diston


    http://www.smartmobiledevice.co.uk/
    Tuesday, May 12, 2009 4:05 PM
  • Here is the call stack

    >    WetFormAGC.exe!WetFormAGC.Veg1.Veg1_Load(Object sender = {WetFormAGC.Veg1}, System.EventArgs e = {System.EventArgs}) Line 48    Basic
         System.Windows.Forms.dll!System.Windows.Forms.Form.OnLoad(System.EventArgs e = {System.EventArgs}) + 0x15 bytes   
         System.Windows.Forms.dll!System.Windows.Forms.Form._SetVisibleNotify(bool fVis = true) + 0x25 bytes   
         System.Windows.Forms.dll!System.Windows.Forms.Control.Visible.set(bool value = true) + 0x14 bytes   
         System.Windows.Forms.dll!System.Windows.Forms.Control.Show() + 0x7 bytes   
         WetFormAGC.exe!WetFormAGC.Project1.MenuVeg1_Click(Object sender = {System.Windows.Forms.MenuItem}, System.EventArgs e = {System.EventArgs}) Line 60 + 0x6 bytes    Basic
         System.Windows.Forms.dll!System.Windows.Forms.MenuItem.OnClick(System.EventArgs e = {System.EventArgs}) + 0x15 bytes   
         System.Windows.Forms.dll!System.Windows.Forms.Menu.ProcessMnuProc(System.Windows.Forms.Control ctlThis = {WetFormAGC.Project1}, Microsoft.AGL.Forms.WM wm = WM_MENU_NOTIFYCLICKED, int wParam = 1245401, int lParam = 1) + 0x37 bytes   
         System.Windows.Forms.dll!System.Windows.Forms.Form.WnProc(Microsoft.AGL.Forms.WM wm = WM_MENU_NOTIFYCLICKED, int wParam = 1245401, int lParam = 1) + 0x45 bytes   
         System.Windows.Forms.dll!System.Windows.Forms.Control._InternalWnProc(Microsoft.AGL.Forms.WM wm = WM_MENU_NOTIFYCLICKED, int wParam = 1245401, int lParam = 1) + 0x4 bytes   
         System.Windows.Forms.dll!Microsoft.AGL.Forms.EVL.EnterMainLoop(System.IntPtr hwnMain = 3211285)   
         System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form fm = {WetFormAGC.Project1}) + 0xf bytes   
         WetFormAGC.exe!WetFormAGC.Startup.Main() Line 3 + 0xf bytes    Basic




    Wednesday, May 13, 2009 1:24 PM
  • Hi,

    Is CountForID your own method or part of the framework?

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Wednesday, May 13, 2009 1:26 PM
  • I am sorry. It was a stupid mistake on my part. Syntax error! Thanks so much for your help and sorry to waste your time.

    Ryan
    Wednesday, May 13, 2009 1:35 PM