Results 1 to 3 of 3

Thread: Dataset will not update???

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Red face Dataset will not update???

    I have a dataset on a winform created with the following code:
    Dim objConnection As New OleDb.OleDbConnection(CONNSTRING)
    Dim objOwnerDA As New OleDb.OleDbDataAdapter("Select * from tblItems", objConnection)
    Dim objOwnerCB As New OleDb.OleDbCommandBuilder(objOwnerDA)
    Dim objdataset As New DataSet()
    objdataset.Clear()
    objOwnerDA.FillSchema(objdataset, SchemaType.Source, "tblItems")
    objOwnerDA.Fill(objdataset, "tblItems")
    daCust.Fill(dsCust, "tblClients")

    I have a button on my form which updates the dataset:
    objOwnerDA.Update(objdataset, "tblItems")

    For some reason the update does not reflect the changes made to the dataset on the form.
    Any Ideas?

    I use a combo to search for records with the following code. Could this be interfering in some way?:
    Dim i As Integer, strCurrentID As String
    For i = 1 To objdataset.Tables("tblItems").Rows.Count
    ComboBox2.DisplayMember = objdataset.Tables("tblItems").Rows(i - 1).Item("itemDescription")
    strCurrentID = objdataset.Tables("tblItems").Rows(i - 1).Item("itemDescription")
    ComboBox2.Items.Add(strCurrentID)
    Next
    ComboBox2.SelectedIndex = 0
    FillOwnerDetails()

    Thanks in Advance

    Parksie

  2. #2
    New Member
    Join Date
    Oct 2002
    Posts
    1
    objOwnerDA needs an updatecommand to update data.

  3. #3
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    If you are using SQL server then check out the command builder object which you need to use as it creates the sql on the fly for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width