如何刷新VB中断开连接的数据库 [英] How to refresh disconnected database in vb

查看:103
本文介绍了如何刷新VB中断开连接的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有服务器和客户端版本的Windows应用程序.
SQL数据库安装在服务器版本上,并且客户端可以访问它.

在从客户端打开应用程序时,它会创建一个数据集并对其进行访问;同时,如果还从其他任何客户端PC中打开了该应用程序,它也会为该特定PC创建另一个数据集.任何更改在客户端PC运行时都不可见.

如何刷新断开连接的数据库?

在此先感谢您.

I have created a windows application which have server and client version.
SQL database installs on the Server version and client access it.

At the time of opening the application from client it creates a dataset aqnd access it; at the same time if that application is also opened from any other client pc it also create another dataset for that particulat pc. Any changes are not visible on the client pc runtime.

How do i refresh this disconnected databse?

Thanks in advance.

推荐答案

您已使用数据集,并且在断开连接模式下也可以使用它.
顾名思义,它是一种分离的体系结构". 获取数据后,数据库连接将关闭.因此您无法每次都获取更新的数据.
因此,如果要更新数据,则需要再次访问数据库.
或使用支持连接的体系结构"的类,例如 Datareader .
You have used dataset and it''s worikng in Disconnected mode.
As word suggest its a "Disconnected Architecture." databse connection get closed after data fetched. so you can''t get updated data each time.
so if you want updated data then you need to hit database again.
or use classes that support "connected architectures", like Datareader.


亲爱的先生,

我已经遇到过同样的问题.
我创建了xml文件并在2个数据表(客户端-服务器)之间传输值
Dear Sir,

I have already face this same problem.
i created xml file and transfer the values between 2 datatable (client - server)
DataTable dt1 = new DataTable("Table1"); 
DataTable dt2 = new DataTable("Table2");
dt1.Merge(dt2);
dt1.WriteXml(@"C:\test.xml");



问候
JP.SIVARAJ



Regards
JP.SIVARAJ


您可以创建一个Sub来清除DataSet并再次填充它,在按钮事件或计时器中将此Sub写进来
you can make a Sub to clear DataSet and Fill it again , write this sub in a button event or a timer


这篇关于如何刷新VB中断开连接的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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