database update

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AWW

    database update

    XP - VB 2005 - Sql Express 2005
    I added data to a defined but empty dataset - reflected in a
    datagridview.
    I then followed the instructions in

    to write the code below:
    -------------------------------------------------------------------
    Me.CBOEdbDataSe t.StocksMain.Ac ceptChanges()
    Try
    Validate()
    ' Me.StocksMainBi ndingSource.End Edit()
    Me.StocksMainTa bleAdapter.Upda te(Me.CBOEdbDat aSet.StocksMain )
    MsgBox("Update Worked")
    Catch ex As Exception
    MsgBox("Update Failed")
    End Try
    ------------------------------
    I get the "Update Worked" message but it DID NOT work.
    What else do I need? How do diagnose and fix this?
    Thanks.
  • =?Utf-8?B?S2VycnkgTW9vcm1hbg==?=

    #2
    RE: database update

    AWW,

    Don't call AcceptChanges.

    Kerry Moorman


    "AWW" wrote:
    XP - VB 2005 - Sql Express 2005
    I added data to a defined but empty dataset - reflected in a
    datagridview.
    I then followed the instructions in

    to write the code below:
    -------------------------------------------------------------------
    Me.CBOEdbDataSe t.StocksMain.Ac ceptChanges()
    Try
    Validate()
    ' Me.StocksMainBi ndingSource.End Edit()
    Me.StocksMainTa bleAdapter.Upda te(Me.CBOEdbDat aSet.StocksMain )
    MsgBox("Update Worked")
    Catch ex As Exception
    MsgBox("Update Failed")
    End Try
    ------------------------------
    I get the "Update Worked" message but it DID NOT work.
    What else do I need? How do diagnose and fix this?
    Thanks.
    >

    Comment

    • AWW

      #3
      Re: database update

      Removed AcceptChanges and now get "Update Failed"
      which makes more sense since it did fail.
      Thoughts?
      Also printed out the "ex" exception - multiple lines with last one
      pointing at "Return Me.Adapter.Upda te(data table)"

      On Sun, 23 Mar 2008 18:24:00 -0700, Kerry Moorman
      <KerryMoorman@d iscussions.micr osoft.comwrote:
      >AWW,
      >
      >Don't call AcceptChanges.
      >
      >Kerry Moorman
      >
      >
      >"AWW" wrote:
      >
      >XP - VB 2005 - Sql Express 2005
      >I added data to a defined but empty dataset - reflected in a
      >datagridview .
      >I then followed the instructions in
      >http://msdn2.microsoft.com/en-us/library/xzb1zw3x.aspx
      >to write the code below:
      >-------------------------------------------------------------------
      >Me.CBOEdbDataS et.StocksMain.A cceptChanges()
      >Try
      >Validate()
      >' Me.StocksMainBi ndingSource.End Edit()
      >Me.StocksMainT ableAdapter.Upd ate(Me.CBOEdbDa taSet.StocksMai n)
      >MsgBox("Upda te Worked")
      >Catch ex As Exception
      >MsgBox("Upda te Failed")
      >End Try
      >------------------------------
      >I get the "Update Worked" message but it DID NOT work.
      >What else do I need? How do diagnose and fix this?
      >Thanks.
      >>

      Comment

      • Armin Zingler

        #4
        Re: database update

        <AWWschrieb
        Removed AcceptChanges and now get "Update Failed"
        which makes more sense since it did fail.
        Thoughts?
        Also printed out the "ex" exception - multiple lines with last one
        pointing at "Return Me.Adapter.Upda te(data table)"
        Is "Update Failed" all in ex.message? Maybe you have to examine 'ex' and
        look at the instance type members (ex might be of type SqlException
        which has many additional members compared to System.Exceptio n). Or,
        better, add "catch ex as SqlException" *before* "catch ex as exception".
        Run again and examine that ex-object.


        Armin

        Comment

        Working...