Results 1 to 11 of 11

Thread: DataSet Question

  1. #1

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134

    DataSet Question

    I'm having some sort of Problem with my DataSet not updating, it Worked fine before I made some changes.
    The Changes that I made where as follows: I used to have two separate Databases in my Project but do to some updates I decided to change it and use only one Database with One Table.(not a Typo One Table.
    All columns are bound to both DataSets and adding data works fine, but when I try to update or Delete it comes up whit this Error: "Update requires a valid DeleteCommand when passed DataRow collection with deleted rows." Somehow I'm missing something!
    Would someone care to help or explain?
    Thanks!
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    The errors says it all, look at your code and see if you have a delete command associated with the dataadapter.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    Well I must have made a mistake somewhere, I deleted both of the DataAdapters and started over. And now it is working again.
    Thanks!
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  4. #4

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    I have another Question about the two forms that I'm using?
    I'm declaring form2 as owned by form1 and I would like to like to refresh my database when closing form2.
    Can this be done from form2 or will I have to write code in form1??
    Thanks!
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  5. #5
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    What do you mean by "refresh my database" ? do you want to update the database with changes you made? If so it depends on your design. If you change the dataset contents in form2 and you already have a connection and adapter there, then do it there.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  6. #6

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    No, I have 2 forms and 2 datasets after saving the changes in form2 I have to refresh form1 the datasets are bound to the same columns!
    If I want to see the changes in my form1 I have to click the Load Data button, I don't want to have to do this I'd rather do it somehow when closing form2.
    I hope this makes sense now.
    Thanks!
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  7. #7
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    One way is to refill the dataset in form1 from the database again. If you are showing form2 modally and you dont need to show form1 while form2 is shown, then close form2 and before showing form1 again refill the data. Still I think you can do it in form2 but this way is easier.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  8. #8

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    I should have thought about it a little longer and used a tab form instead of using 2 forms. O well, to late now.
    I’m still thinking about how to do it with form2.
    Here is what I’m doing with a Label:

    Open form2:
    Code:
    Dim bla As new Form2
    MyBase.AddOwnedForm(bla)
    bla.ShowDialog()
    Closing form2
    Code:
    Dim fMain As New frmMain
    fMain = CType (Me.Owner, frmMain)
    fMain.Label1.Text = Label1.Text
    Can I not use something like this for reloading Data as well??
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  9. #9
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Sure u can. I thought that would be a little tricky to do it, but seems you already know the trick.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  10. #10

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    Unfortunately No, I can only get hat trick to work for my label but not for reloading the Database. I just wanted to show you what I had already and was hoping once you look at it maybe you would see a way of doing it!
    But hey, Thanks for all the help anyway!
    Maybe I’ll be able to finish this thing tomorrow!
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

  11. #11

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    Never mind, that was almost to easy to tell someone.
    I created a Public Function Reload() and called the LoadData in it.
    Again thanks for the Help!!
    Code:
    Dim R1 As Fast 
    Dim Kawasaki As crap
    Dim rash As necessary
    If Kawasaki onRoad = True Then
        R1.runoverKawasaki
    Kawasaki = rash

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