P
processoriented
I am trying to find the best approach to do something here...
situation is this... One of the tables in my dataset is a "Work Order"
table with information about what needs to be done and where. Say my
user goes on site to do the work associated with the work order, and
while he is there, he discovers that the customer's phone number has
changed. Should be no problem, he opens up the app, looks at his list
of open work orders, finds the work order in question, and changes the
phone number. When he re-connects to the network and has access to the
database, the app just updates the work order table with the new phone
number. This is pretty simple, on the initial download to the user's
machine, I just store the work order table (along with everything else
in the dataset) to an xml doc like this:
Dim ds as New DataSet
' code to connect to database and fill the dataset goes here
ds.writexml(strFolder & "app_data.xml", XmlWriteMode.WriteSchema)
Great... user then turns off his machine, goes out to the customer's
site and realizes that the phone number needs to be changed... now when
he turns on his computer and fires up the application, it needs to show
him a list of his open work orders... again, this is simple:
Dim ds as New DataSet
ds.readxml(strFolder & "app_data.xml",XmlReadMode.ReadSchema)
'Code to parse through the dataset and display the relavant information
goes here...
Now that my user can see and modify all his open work orders, my code
will let him make modifications like this...
'This code appears in the btnSubmitChanges Click event
Dim tblToModify as DataTable = ds.tables("WorkOrders")
Dim rowToModify as DataRow = tblToModify.Rows.Find(strRowKey)
rowToModify.Items("Phone") = strNewPhoneNumber
'....
ds.writexml(strFolder & "modified_data.xml", XmlWriteMode.DiffGram)
Fantastic! Now my dataset has a record, not only of what the new phone
number is, but what it used to be, and I can use the rowstate
properties to look at both sets of information... but here is where I
am confused:
I can save the changes with a DiffGram style XML doc, but then what do
I do with the original XML doc and the DiffGram when I get back
on-line?
Moreover, what happens if my user switches off the computer and
switches it back on? Sure the computer has a record of the modified
data in the diffgram xml doc, but the code isn't looking there to show
him his list of open work-orders.
Basically what I am asking is this: I have my base data and my
modifications stored in a couple of XML docs, but how do I take the
information in those two xml docs and turn them back into the same
dataset I had right after my user made his changes? Or, should it
really be two different documents? Is there a way to do it in one
document? What happens if the user makes multiple modifications to the
data, turning on and off the computer in between each modification
prior to sending those changes back to the database?
situation is this... One of the tables in my dataset is a "Work Order"
table with information about what needs to be done and where. Say my
user goes on site to do the work associated with the work order, and
while he is there, he discovers that the customer's phone number has
changed. Should be no problem, he opens up the app, looks at his list
of open work orders, finds the work order in question, and changes the
phone number. When he re-connects to the network and has access to the
database, the app just updates the work order table with the new phone
number. This is pretty simple, on the initial download to the user's
machine, I just store the work order table (along with everything else
in the dataset) to an xml doc like this:
Dim ds as New DataSet
' code to connect to database and fill the dataset goes here
ds.writexml(strFolder & "app_data.xml", XmlWriteMode.WriteSchema)
Great... user then turns off his machine, goes out to the customer's
site and realizes that the phone number needs to be changed... now when
he turns on his computer and fires up the application, it needs to show
him a list of his open work orders... again, this is simple:
Dim ds as New DataSet
ds.readxml(strFolder & "app_data.xml",XmlReadMode.ReadSchema)
'Code to parse through the dataset and display the relavant information
goes here...
Now that my user can see and modify all his open work orders, my code
will let him make modifications like this...
'This code appears in the btnSubmitChanges Click event
Dim tblToModify as DataTable = ds.tables("WorkOrders")
Dim rowToModify as DataRow = tblToModify.Rows.Find(strRowKey)
rowToModify.Items("Phone") = strNewPhoneNumber
'....
ds.writexml(strFolder & "modified_data.xml", XmlWriteMode.DiffGram)
Fantastic! Now my dataset has a record, not only of what the new phone
number is, but what it used to be, and I can use the rowstate
properties to look at both sets of information... but here is where I
am confused:
I can save the changes with a DiffGram style XML doc, but then what do
I do with the original XML doc and the DiffGram when I get back
on-line?
Moreover, what happens if my user switches off the computer and
switches it back on? Sure the computer has a record of the modified
data in the diffgram xml doc, but the code isn't looking there to show
him his list of open work-orders.
Basically what I am asking is this: I have my base data and my
modifications stored in a couple of XML docs, but how do I take the
information in those two xml docs and turn them back into the same
dataset I had right after my user made his changes? Or, should it
really be two different documents? Is there a way to do it in one
document? What happens if the user makes multiple modifications to the
data, turning on and off the computer in between each modification
prior to sending those changes back to the database?