datasource updates not persistent

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

    #1

    datasource updates not persistent

    This is driving me nuts. I've tried everything I can think of. I'm
    using VS.net2005 and I backtracked to trying code straight out of the
    Microsoft "simple data application" tutorials with no luck.

    I have a simple single table access database added to my project, drag
    the datasource onto a form everything is created beautifully I can
    navigate through the records, modify things, click the save button
    etc... but no changes are ever written to the database. If I stop and
    restart the app, I'm right back where I started. Below is the entire
    form1 that was created by default, all I added was the try/catch and
    messageboxes.


    Public Class Form1
    Private Sub MotorsBindingNa vigatorSaveItem _Click(ByVal sender As
    System.Object, ByVal e As System.EventArg s) Handles
    MotorsBindingNa vigatorSaveItem .Click
    Try
    Me.Validate()
    Me.MotorsBindin gSource.EndEdit ()

    Me.MotorsTableA dapter.Update(M e.Partsdatabase DataSet.motors)
    MsgBox("Update successful")
    Catch ex As Exception
    MsgBox("Update failed")
    End Try
    End Sub

    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    'TODO: This line of code loads data into the
    'PartsdatabaseD ataSet.motors' table. You can move, or remove it, as
    needed.
    Me.MotorsTableA dapter.Fill(Me. PartsdatabaseDa taSet.motors)

    End Sub
    End Class

  • AMDRIT

    #2
    Re: datasource updates not persistent

    You can do a couple things to test for changes.

    Here is one:

    PartsdatabaseDa taSet.GetChange s(added or modified or deleted) will return a
    dataset with only the data that was changed. If this returns 0 rows, you do
    not have any changes.

    If you do have a rowset of changes, then use SQL Profiler (If you are
    connecting to a SQL Database) and view the SQL statements that are being
    issued to the SQL server. If there are none, then the table adapter isn't
    detecting changes.

    Try removing the Me.MotorsBindin gSource.EndEdit () and the Me.Validate()
    lines to see if anything changes.




    "Ted" <TheodoreWard@h otmail.comwrote in message
    news:1176825751 .162701.165550@ e65g2000hsc.goo glegroups.com.. .
    This is driving me nuts. I've tried everything I can think of. I'm
    using VS.net2005 and I backtracked to trying code straight out of the
    Microsoft "simple data application" tutorials with no luck.
    >
    I have a simple single table access database added to my project, drag
    the datasource onto a form everything is created beautifully I can
    navigate through the records, modify things, click the save button
    etc... but no changes are ever written to the database. If I stop and
    restart the app, I'm right back where I started. Below is the entire
    form1 that was created by default, all I added was the try/catch and
    messageboxes.
    >
    >
    Public Class Form1
    Private Sub MotorsBindingNa vigatorSaveItem _Click(ByVal sender As
    System.Object, ByVal e As System.EventArg s) Handles
    MotorsBindingNa vigatorSaveItem .Click
    Try
    Me.Validate()
    Me.MotorsBindin gSource.EndEdit ()
    >
    Me.MotorsTableA dapter.Update(M e.Partsdatabase DataSet.motors)
    MsgBox("Update successful")
    Catch ex As Exception
    MsgBox("Update failed")
    End Try
    End Sub
    >
    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    'TODO: This line of code loads data into the
    'PartsdatabaseD ataSet.motors' table. You can move, or remove it, as
    needed.
    Me.MotorsTableA dapter.Fill(Me. PartsdatabaseDa taSet.motors)
    >
    End Sub
    End Class
    >

    Comment

    • Ted

      #3
      Re: datasource updates not persistent

      On Apr 17, 10:45 am, "AMDRIT" <amd...@hotmail .comwrote:
      You can do a couple things to test for changes.
      >
      Here is one:
      >
      PartsdatabaseDa taSet.GetChange s(added or modified or deleted) will return a
      dataset with only the data that was changed. If this returns 0 rows, you do
      not have any changes.
      >
      If you do have a rowset of changes, then use SQL Profiler (If you are
      connecting to a SQL Database) and view the SQL statements that are being
      issued to the SQL server. If there are none, then the table adapter isn't
      detecting changes.
      >
      Try removing the Me.MotorsBindin gSource.EndEdit () and the Me.Validate()
      lines to see if anything changes.

      Thanks for the reply. I am using Access as the database, but I tried
      the following:

      Dim ds As DataSet = PartsdatabaseDa taSet.GetChange s()

      Me.MotorsTableA dapter.Update(M e.Partsdatabase DataSet.motors)
      ds = PartsdatabaseDa taSet.GetChange s()

      ds is set to something the first time, after the update it is set to
      nothing, the update still is not persisted to the database (I removed
      the validate and endedit with no luck) I get no errors.... I tried
      rebooting no help.

      Comment

      • =?Utf-8?B?S2VycnkgTW9vcm1hbg==?=

        #4
        RE: datasource updates not persistent

        Ted,

        Could be this:

        http://msdn2.microsoft.com/en-us/library/ms246989.aspx

        Kerry Moorman


        "Ted" wrote:
        This is driving me nuts. I've tried everything I can think of. I'm
        using VS.net2005 and I backtracked to trying code straight out of the
        Microsoft "simple data application" tutorials with no luck.
        >
        I have a simple single table access database added to my project, drag
        the datasource onto a form everything is created beautifully I can
        navigate through the records, modify things, click the save button
        etc... but no changes are ever written to the database. If I stop and
        restart the app, I'm right back where I started. Below is the entire
        form1 that was created by default, all I added was the try/catch and
        messageboxes.
        >
        >
        Public Class Form1
        Private Sub MotorsBindingNa vigatorSaveItem _Click(ByVal sender As
        System.Object, ByVal e As System.EventArg s) Handles
        MotorsBindingNa vigatorSaveItem .Click
        Try
        Me.Validate()
        Me.MotorsBindin gSource.EndEdit ()
        >
        Me.MotorsTableA dapter.Update(M e.Partsdatabase DataSet.motors)
        MsgBox("Update successful")
        Catch ex As Exception
        MsgBox("Update failed")
        End Try
        End Sub
        >
        Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        'TODO: This line of code loads data into the
        'PartsdatabaseD ataSet.motors' table. You can move, or remove it, as
        needed.
        Me.MotorsTableA dapter.Fill(Me. PartsdatabaseDa taSet.motors)
        >
        End Sub
        End Class
        >
        >

        Comment

        • Ted

          #5
          Re: datasource updates not persistent

          On Apr 17, 6:16 pm, Kerry Moorman
          <KerryMoor...@d iscussions.micr osoft.comwrote:
          Ted,
          >
          Could be this:
          >
          http://msdn2.microsoft.com/en-us/library/ms246989.aspx
          >
          Kerry Moorman
          <snip>

          Kerry, I don't know you, but you are awesome. I haven't tried it yet,
          but that is clearly the problem.

          Thanks a bunch.

          Ted Ward

          Comment

          Working...