Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help on Datasets

Help on Datasets

Scheduled Pinned Locked Moved Visual Basic
helpcsharpdatabaseannouncement
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pete Newman
    wrote on last edited by
    #1

    running vb.net 2005 & sql 2005 Ive been trying to add what seemed a simple table to a form ... only three four fields plus an update and cancel button I managed to ( from samples ) add an OleDbConnection connecton, a OleDbDataAdapter complete with select and update commands and a dataset . From previous samples ( win 2003 dataform ) i have the four text boxex reporting back the data from the dataset ... Stage 1 complete. now here is where i was comming a cropper, when trying to update the table i used the following commands Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click Try 'Attempt to update the datasource. Me.UpdateDataSet() MsgBox(" Update sucessful") Catch eUpdate As System.Exception 'Add your error handling code here. 'Display error message, if any. System.Windows.Forms.MessageBox.Show(eUpdate.Message) End Try End Sub Public Sub UpdateDataSet() 'Create a new dataset to hold the changes that have been made to the main dataset. Dim objDataSetChanges As Boss.net.DebBacsFmDestAccs = New Boss.net.DebBacsFmDestAccs 'Stop any current edits. Me.BindingContext(DebBacsFMDestAccounts1, "DebBacsFmDestAccs").EndCurrentEdit() 'Get the changes that have been made to the main dataset. objDataSetChanges = CType(DebBacsFMDestAccounts1.GetChanges, Boss.net.DebBacsFmDestAccs) 'Check to see if any changes have been made. If (Not (objDataSetChanges) Is Nothing) Then Try 'There are changes that need to be made, so attempt to update the datasource by 'calling the update method and passing the dataset and any parameters. Me.UpdateDataSource(objDataSetChanges) DebBacsFMDestAccounts1.Merge(objDataSetChanges) DebBacsFMDestAccounts1.AcceptChanges() Catch eUpdate As System.Exception 'Add your error handling code here. Throw eUpdate End Try 'Add your code to check the returned dataset for any errors that may have been 'pushed into the row object's error. End If End Sub Public Sub UpdateDataSource(ByVal ChangedRows As Boss.net.DebBacsFmDestAccs) Try 'The data source only needs to be updated if there are changes pending. If (Not (Ch

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups