469,097 Members | 1,540 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,097 developers. It's quick & easy.

Dataset Declaration again ... CJ listening? Anyone else

OK i have came to the conclusion that since this app will be run on multiple computers that loading a complete database and then updating on exit is a moot point. I have tried several ideas submitted, but i am unable to get one of them to work completely. Here is the code i had before i realized that when i filled the dataset in the form load procedure that it would "ruin, replace, mess up" the dataset named the same thing on the other form. Below is my Update, Add, Edit and Cancel code and an exerpt from the form load which like i say, worked fine before i realized i would have to change where i declared my datasets. Do i need to programmtically code my datasets in a module, (someone else mentioned that) and if so how? so that every time a childform is loaded or made active it has an updated set of data? and i do not have several datasets containing the same data? The way i was currently headed i would have had a trailers dataset containing all trailer info and a seperate dataset containing only trailer numbers for use in another form. I have been reading all day, and am still just about where i was earlier.
I tried this and got syntax errors.
childs form class
dim tform as mdiMainForm (whatever the type is)
tForm = me.mdiParent
me.dsWhatever.merge (tForm.dsName1)

"PLEASE NOTE: The parts that were commented out worked great until i realized they wouldn't work... uh.. well you know what i mean.
Form Load
Private Const cblnEditing As Boolean = True
Private Const cblnNotEditing As Boolean = False
' I used to fill them this way beacuse they were created on the child form, but that doesn't work since each child form has at least 2 of these
' So I asked and was given the right idea and think i have a pretty good understanding now, but i still do not know where or how to declare my 'datasets any differently so that each form can access them and be updated when the active child changes.
odbdaTrailers.fill(dsTrailers1)
odbdaTrucks.fill(dsTrucks1)
odbdaDrivers.fill(dsDrivers1)
.....ETC ETC ETC
End Form Load

Private Sub AddData()
' Set the menu items to indicate that a record is being edited.
Call EditState(cblnEditing)
' Add a new record.
'Worked the whole way but not since i need the portions of the same dataset across multiple forms
'Me.BindingContext(DsTrailers1, "equipTrailers").AddNew()
End Sub

Private Sub EditData()
Call EditState(cblnEditing)
End Sub

Private Sub CancelData()
' Update the menu items to not editing.
Call EditState(cblnNotEditing)
'Me.BindingContext(DsTrailers1, "EquipTrailers").CancelCurrentEdit()
End Sub

Private Sub UpdateData()
' Temporary DataSets to store the inserted or modified row.
Dim pdsInsertedRows, pdsModifiedRows As DataSet
' Set the menu items to editing.
Call EditState(cblnNotEditing)

' End editing on the current record.
' Me.BindingContext(DsTrailers1, "equiptrailers").EndCurrentEdit()

' Copy the DataSets by getting added/modified records from original DataSet.
'pdsInsertedRows = DsTrailers1.GetChanges(DataRowState.Added)
'pdsModifiedRows = DsTrailers1.GetChanges(DataRowState.Modified)

' Check to see if there is an inserted row. If there is update DataSet.
If Not pdsInsertedRows Is Nothing Then
' odbdaTrailers.Update(pdsInsertedRows)
End If

' Check to see if there is a modified row. If there is update dataset
If Not pdsModifiedRows Is Nothing Then
' odbdaTrailers.Update(pdsModifiedRows)
End If

' Synchronize the database to dataset
' DsTrailers1.AcceptChanges()
End Sub
Nov 20 '05 #1
2 1666
Jeff,

I do'nt think I understand what your asking here... your code is alittle vague to answer a question on it. I apologize.

You have a lot of commented out stuff that shoulnd't necessarily be commented out.
Thanks,
CJ
"Jeff Brown" <no******@thistime.com> wrote in message news:Od*****************@twister.austin.rr.com...
OK i have came to the conclusion that since this app will be run on multiple computers that loading a complete database and then updating on exit is a moot point. I have tried several ideas submitted, but i am unable to get one of them to work completely. Here is the code i had before i realized that when i filled the dataset in the form load procedure that it would "ruin, replace, mess up" the dataset named the same thing on the other form. Below is my Update, Add, Edit and Cancel code and an exerpt from the form load which like i say, worked fine before i realized i would have to change where i declared my datasets. Do i need to programmtically code my datasets in a module, (someone else mentioned that) and if so how? so that every time a childform is loaded or made active it has an updated set of data? and i do not have several datasets containing the same data? The way i was currently headed i would have had a trailers dataset containing all trailer info and a seperate dataset containing only trailer numbers for use in another form. I have been reading all day, and am still just about where i was earlier.
I tried this and got syntax errors.
childs form class
dim tform as mdiMainForm (whatever the type is)
tForm = me.mdiParent
me.dsWhatever.merge (tForm.dsName1)

"PLEASE NOTE: The parts that were commented out worked great until i realized they wouldn't work... uh.. well you know what i mean.
Form Load
Private Const cblnEditing As Boolean = True
Private Const cblnNotEditing As Boolean = False
' I used to fill them this way beacuse they were created on the child form, but that doesn't work since each child form has at least 2 of these
' So I asked and was given the right idea and think i have a pretty good understanding now, but i still do not know where or how to declare my 'datasets any differently so that each form can access them and be updated when the active child changes.
odbdaTrailers.fill(dsTrailers1)
odbdaTrucks.fill(dsTrucks1)
odbdaDrivers.fill(dsDrivers1)
....ETC ETC ETC
End Form Load

Private Sub AddData()
' Set the menu items to indicate that a record is being edited.
Call EditState(cblnEditing)
' Add a new record.
'Worked the whole way but not since i need the portions of the same dataset across multiple forms
'Me.BindingContext(DsTrailers1, "equipTrailers").AddNew()
End Sub

Private Sub EditData()
Call EditState(cblnEditing)
End Sub

Private Sub CancelData()
' Update the menu items to not editing.
Call EditState(cblnNotEditing)
'Me.BindingContext(DsTrailers1, "EquipTrailers").CancelCurrentEdit()
End Sub

Private Sub UpdateData()
' Temporary DataSets to store the inserted or modified row.
Dim pdsInsertedRows, pdsModifiedRows As DataSet
' Set the menu items to editing.
Call EditState(cblnNotEditing)

' End editing on the current record.
' Me.BindingContext(DsTrailers1, "equiptrailers").EndCurrentEdit()

' Copy the DataSets by getting added/modified records from original DataSet.
'pdsInsertedRows = DsTrailers1.GetChanges(DataRowState.Added)
'pdsModifiedRows = DsTrailers1.GetChanges(DataRowState.Modified)

' Check to see if there is an inserted row. If there is update DataSet.
If Not pdsInsertedRows Is Nothing Then
' odbdaTrailers.Update(pdsInsertedRows)
End If

' Check to see if there is a modified row. If there is update dataset
If Not pdsModifiedRows Is Nothing Then
' odbdaTrailers.Update(pdsModifiedRows)
End If

' Synchronize the database to dataset
' DsTrailers1.AcceptChanges()
End Sub
Nov 20 '05 #2
Yeah i commented it out because i had removed the ds's contained in the project and started over in order to quit getting errors(just commented it out so i wouldn't have to retype if i used the same names), I am going to get another book so that maybe if i cannot figure it out at least i will be able to ask my question correctly. If you have a Yahoo mail account you don't use i can send the whole project to you for you to take a look at and then maybe you will understand what i do not know how to ask. hehehe. Basically, dsTrailers1 gets filled on form1 and needs certain fields and then on form2 dsTrailers1 gets filled with different fields, but the problem lies in where i declare them and how to access them because when i load form1 and do something it works fine, but then if i load form2 i get an error because the dataadapter on each form redefined the dsTrailers.xsd and eliminated needed fields, maybe i should work with dataviews based on the entire "Trailer" table , hence trailers.xsd wouldn't get redifined . Gone to books a million , hehehe, give me a week and i will at least know how to ask my question if i still have one. Thanks for everyones help, sorry to seem so "leechy", but i try to contibute where i can.

Thanks,
Jeff
"CJ Taylor" <no****@blowgoats.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Jeff,

I do'nt think I understand what your asking here... your code is alittle vague to answer a question on it. I apologize.

You have a lot of commented out stuff that shoulnd't necessarily be commented out.
Thanks,
CJ
"Jeff Brown" <no******@thistime.com> wrote in message news:Od*****************@twister.austin.rr.com...
OK i have came to the conclusion that since this app will be run on multiple computers that loading a complete database and then updating on exit is a moot point. I have tried several ideas submitted, but i am unable to get one of them to work completely. Here is the code i had before i realized that when i filled the dataset in the form load procedure that it would "ruin, replace, mess up" the dataset named the same thing on the other form. Below is my Update, Add, Edit and Cancel code and an exerpt from the form load which like i say, worked fine before i realized i would have to change where i declared my datasets. Do i need to programmtically code my datasets in a module, (someone else mentioned that) and if so how? so that every time a childform is loaded or made active it has an updated set of data? and i do not have several datasets containing the same data? The way i was currently headed i would have had a trailers dataset containing all trailer info and a seperate dataset containing only trailer numbers for use in another form. I have been reading all day, and am still just about where i was earlier.
I tried this and got syntax errors.
childs form class
dim tform as mdiMainForm (whatever the type is)
tForm = me.mdiParent
me.dsWhatever.merge (tForm.dsName1)

"PLEASE NOTE: The parts that were commented out worked great until i realized they wouldn't work... uh.. well you know what i mean.
Form Load
Private Const cblnEditing As Boolean = True
Private Const cblnNotEditing As Boolean = False
' I used to fill them this way beacuse they were created on the child form, but that doesn't work since each child form has at least 2 of these
' So I asked and was given the right idea and think i have a pretty good understanding now, but i still do not know where or how to declare my 'datasets any differently so that each form can access them and be updated when the active child changes.
odbdaTrailers.fill(dsTrailers1)
odbdaTrucks.fill(dsTrucks1)
odbdaDrivers.fill(dsDrivers1)
....ETC ETC ETC
End Form Load

Private Sub AddData()
' Set the menu items to indicate that a record is being edited.
Call EditState(cblnEditing)
' Add a new record.
'Worked the whole way but not since i need the portions of the same dataset across multiple forms
'Me.BindingContext(DsTrailers1, "equipTrailers").AddNew()
End Sub

Private Sub EditData()
Call EditState(cblnEditing)
End Sub

Private Sub CancelData()
' Update the menu items to not editing.
Call EditState(cblnNotEditing)
'Me.BindingContext(DsTrailers1, "EquipTrailers").CancelCurrentEdit()
End Sub

Private Sub UpdateData()
' Temporary DataSets to store the inserted or modified row.
Dim pdsInsertedRows, pdsModifiedRows As DataSet
' Set the menu items to editing.
Call EditState(cblnNotEditing)

' End editing on the current record.
' Me.BindingContext(DsTrailers1, "equiptrailers").EndCurrentEdit()

' Copy the DataSets by getting added/modified records from original DataSet.
'pdsInsertedRows = DsTrailers1.GetChanges(DataRowState.Added)
'pdsModifiedRows = DsTrailers1.GetChanges(DataRowState.Modified)

' Check to see if there is an inserted row. If there is update DataSet.
If Not pdsInsertedRows Is Nothing Then
' odbdaTrailers.Update(pdsInsertedRows)
End If

' Check to see if there is a modified row. If there is update dataset
If Not pdsModifiedRows Is Nothing Then
' odbdaTrailers.Update(pdsModifiedRows)
End If

' Synchronize the database to dataset
' DsTrailers1.AcceptChanges()
End Sub
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Bishoy George | last post: by
5 posts views Thread by Roy Lawson | last post: by
16 posts views Thread by Geoff Jones | last post: by
22 posts views Thread by Arne | last post: by
8 posts views Thread by GaryDean | last post: by
8 posts views Thread by Harry Strybos | last post: by
4 posts views Thread by John Sheppard | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.