将数据集存储到磁盘的最佳方法??? [英] Best way to store dataset to disk???

查看:67
本文介绍了将数据集存储到磁盘的最佳方法???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力寻找在这里做某事的最佳方法......

情况就是这样......我的数据集中的一个表是工作单

表,其中包含有关需要执行的操作和位置的信息。说我的

用户到现场做与工作单相关的工作,并且当他在那里时,他发现客户的电话号码

已更改。应该没问题,他打开应用程序,查看他的列表

的打开工作单,找到有问题的工作单,并更改

的电话号码。当他重新连接到网络并可以访问

数据库时,应用程序只需使用新手机

编号更新工作单表。这很简单,在初次下载到用户的

机器时,我只是存储工单表(以及数据集中的所有其他内容

)到这样的xml文档:


Dim ds作为新数据集

''代码连接到数据库并填充数据集到这里

ds.writexml(strFolder&"" app_data.xml",XmlWriteMode.WriteSchema)

很棒...用户然后关闭他的机器,去客户的

网站,并意识到需要更改电话号码......现在,当他打开电脑并启动应用程序时,它需要显示

他列出了他的公开工单...再次,这很简单:


Dim ds作为新数据集

ds.readxml(strFolder& ;app_data.xml,XmlReadMode.ReadSchema)

''用于解析数据集并显示相关信息的代码

就在这里......


现在我的用户可以查看和修改他所有打开的工单,我的代码

会让他做出这样的修改......


''此代码出现在btnSubmitChanges Click事件

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)


太棒了!现在我的数据集有一个记录,不仅是新手机的价值是多少,而且过去是什么,我可以使用rowstate

属性来查看这两组信息......但是这里我感到很困惑:

我可以使用DiffGram样式的XML文档保存更改,但是那样做什么

当我回来时,我使用原始XML文档和DiffGram

联机?


此外,如果我的用户会发生什么关掉电脑,然后再打开它?b $ b将它重新打开?当然计算机在diffgram xml doc中记录了修改过的

数据,但代码并没有在那里显示

他的开放工作清单 - 订单。


基本上我要问的是:我的基础数据和我的

修改存储在几个XML文档中,但我怎么做在这两个xml文档中获取

信息并将它们转回我用户进行更改后的相同

数据集?或者,它应该是
真的是两个不同的文件吗?有没有办法在一个

文件中做到这一点?如果用户对

数据进行多次修改,在每次修改之间打开和关闭计算机

,然后再将这些更改发送回数据库,会发生什么? />

解决方案

将其存储在数据库中; jackass

processoriented写道:


我正在努力寻找在这里做点什么的最佳方法...

情况就是这样......我的数据集中的一个表是一个工作订单

表,其中包含有关需要做什么以及在哪里做的信息。说我的

用户到现场做与工作单相关的工作,并且当他在那里时,他发现客户的电话号码

已更改。应该没问题,他打开应用程序,查看他的列表

的打开工作单,找到有问题的工作单,并更改

的电话号码。当他重新连接到网络并可以访问

数据库时,应用程序只需使用新手机

编号更新工作单表。这很简单,在初次下载到用户的

机器时,我只是存储工单表(以及数据集中的所有其他内容

)到这样的xml文档:


Dim ds作为新数据集

''代码连接到数据库并填充数据集到这里

ds.writexml(strFolder&"" app_data.xml",XmlWriteMode.WriteSchema)


很棒...用户然后关闭他的机器,去客户'' s $ / b $ b网站,并意识到需要更改电话号码......现在,当他打开电脑并启动应用程序时,它需要显示

他列出了他的公开工作单...再次,这很简单:


Dim ds作为新数据集

ds。 readxml(strFolder&"" app_data.xml",XmlReadMode.ReadSchema)

''用于解析数据集并显示相关信息的代码

在这里...


现在我的用户可以看到并修改他所有打开的工单,我的代码

会让他做出这样的修改......


''此代码出现在btnSubmitChanges Click事件

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)


太棒了!现在我的数据集有一个记录,不仅是新手机的价值是多少,而且过去是什么,我可以使用rowstate

属性来查看这两组信息......但是这里我感到很困惑:

我可以使用DiffGram样式的XML文档保存更改,但是那样做什么

当我回来时,我使用原始XML文档和DiffGram

联机?


此外,如果我的用户会发生什么关掉电脑,然后再打开它?b $ b将它重新打开?当然计算机在diffgram xml doc中记录了修改过的

数据,但代码并没有在那里显示

他的开放工作清单 - 订单。


基本上我要问的是:我的基础数据和我的

修改存储在几个XML文档中,但我怎么做在这两个xml文档中获取

信息并将它们转回我用户进行更改后的相同

数据集?或者,它应该是
真的是两个不同的文件吗?有没有办法在一个

文件中做到这一点?如果用户对

数据进行多次修改,在每次修改之间打开和关闭计算机

,然后再将这些更改发送回数据库,会发生什么?


不是很有帮助的建议,但至少它很粗鲁。

su ****** @ hotmail.com 写道:


将其存储在数据库中; jackass


processor oriented写道:


我想找到最好的方法来做点什么...

情况就是这样......我的数据集中的一个表是一个工作订单

表,其中包含有关需要做什么以及在哪里做的信息。说我的

用户到现场做与工作单相关的工作,并且当他在那里时,他发现客户的电话号码

已更改。应该没问题,他打开应用程序,查看他的列表

的打开工作单,找到有问题的工作单,并更改

的电话号码。当他重新连接到网络并可以访问

数据库时,应用程序只需使用新手机

编号更新工作单表。这很简单,在初次下载到用户的

机器时,我只是存储工单表(以及数据集中的所有其他内容

)到这样的xml文档:


Dim ds作为新数据集

''代码连接到数据库并填充数据集到这里

ds.writexml(strFolder&"" app_data.xml",XmlWriteMode.WriteSchema)

很棒...用户然后关闭他的机器,去客户的

网站,并意识到需要更改电话号码......现在,当他打开电脑并启动应用程序时,它需要显示

他列出了他的公开工单...再次,这很简单:


Dim ds作为新数据集

ds.readxml(strFolder& ;app_data.xml,XmlReadMode.ReadSchema)

''用于解析数据集并显示相关信息的代码

就在这里......


既然我的用户可以看到并修改他所有打开的工单,我的代码

会让他做出这样的修改...


''这段代码出现在btnSubmitChanges Click事件中

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)


太棒了!现在我的数据集有一个记录,不仅是新手机的价值是多少,而且过去是什么,我可以使用rowstate

属性来查看这两组信息......但是这里我感到很困惑:

我可以使用DiffGram样式的XML文档保存更改,但是那样做什么

当我回来时,我使用原始XML文档和DiffGram

联机?


此外,如果我的用户会发生什么关掉电脑,然后再打开它?b $ b将它重新打开?当然计算机在diffgram xml doc中记录了修改过的

数据,但代码并没有在那里显示

他的开放工作清单 - 订单。


基本上我要问的是:我的基础数据和我的

修改存储在几个XML文档中,但我怎么做在这两个xml文档中获取

信息并将它们转回我用户进行更改后的相同

数据集?或者,它应该是
真的是两个不同的文件吗?有没有办法在一个

文件中做到这一点?如果用户对

数据进行多次修改,在每次修改之间打开和关闭计算机

,然后再将这些更改发送回数据库,会发生什么?


创建2个数据集然后合并它们


Dataset1.Merge(Dataset2)


试试这个

-

Thiele Enterprises - 权力掌握在你手中!


-

" processoriented" < pr ************* @ gmail.comwrote in message

news:11 ***************** **** @ e3g2000cwe.googlegrou ps.com ...

我正在努力寻找在这里做点什么的最佳方法...

情况就是这个..我的数据集中的一个表是工作订单

表,其中包含有关需要完成的工作和位置的信息。说我的

用户到现场做与工作单相关的工作,并且当他在那里时,他发现客户的电话号码

已更改。应该没问题,他打开应用程序,查看他的列表

的打开工作单,找到有问题的工作单,并更改

的电话号码。当他重新连接到网络并可以访问

数据库时,应用程序只需使用新手机

编号更新工作单表。这很简单,在初次下载到用户的

机器时,我只是存储工单表(以及数据集中的所有其他内容

)到这样的xml文档:


Dim ds作为新数据集

''代码连接到数据库并填充数据集到这里

ds.writexml(strFolder&"" app_data.xml",XmlWriteMode.WriteSchema)

很棒...用户然后关闭他的机器,去客户的

网站,并意识到需要更改电话号码......现在,当他打开电脑并启动应用程序时,它需要显示

他列出了他的公开工单...再次,这很简单:


Dim ds作为新数据集

ds.readxml(strFolder& ;app_data.xml,XmlReadMode.ReadSchema)

''用于解析数据集并显示相关信息的代码

就在这里......


现在我的用户可以查看和修改他所有打开的工单,我的代码

会让他做出这样的修改......


''此代码出现在btnSubmitChanges Click事件

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)


太棒了!现在我的数据集有一个记录,不仅是新手机的价值是多少,而且过去是什么,我可以使用rowstate

属性来查看这两组信息......但是这里我感到很困惑:

我可以使用DiffGram样式的XML文档保存更改,但是那样做什么

当我回来时,我使用原始XML文档和DiffGram

联机?


此外,如果我的用户会发生什么关掉电脑,然后再打开它?b $ b将它重新打开?当然计算机在diffgram xml doc中记录了修改过的

数据,但代码并没有在那里显示

他的开放工作清单 - 订单。


基本上我要问的是:我的基础数据和我的

修改存储在几个XML文档中,但我怎么做在这两个xml文档中获取

信息并将它们转回我用户进行更改后的相同

数据集?或者,它应该是
真的是两个不同的文件吗?有没有办法在一个

文件中做到这一点?如果用户对

数据进行多次修改,在每次修改之间打开和关闭计算机

,然后再将这些更改发送回数据库,会发生什么? />

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?

解决方案

store it in a database; jackass
processoriented wrote:

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?


not very helpful advice, but at least it was rude.

su******@hotmail.com wrote:

store it in a database; jackass
processoriented wrote:

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?


Create 2 datasets then merge them

Dataset1.Merge(Dataset2)

Try this
--
Thiele Enterprises - The Power Is In Your Hands Now!

--
"processoriented" <pr*************@gmail.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
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?


这篇关于将数据集存储到磁盘的最佳方法???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆