工作站pb在cs体系中设置工作站与服务器的时钟同步(Pb sets the clock synchronization between the workstation and the server in the CS system)

cs服务器  时间:2021-01-30  阅读:()

pb在cs体系中设置工作站与服务器的时钟同步Pbsets theclocksynchronization between the workstation and the server in the

CS system

Set up the clock synchronization between the workstation andthe server in the C/S systemabstract

In practical applications often require the client / serverclock and each workstation server architecture of clocksynchronization; the SYBASE database, Powerbuilderdevelopment tools that a solution based on.

I. Preface

PowerBuilder through the data window object, can be convenientand direct operation of the database, so it has become thecurrent development of Client/Server mode application of thepreferred tool for development. In the development of hospitalinformation management system, we used PowerBuilder as a frontdevelopment tool, Sybase as a background database.

The hospital information management system, keep synchronous,time and server modules are many requirements for theworkstation such as: Outpatient charging system requirementscan be uniformly to the siyao window and hospital pharmacydispensing prescription assigned to send orders according tothe time order unit etc. . To solve this problem, wehave writtenthe corresponding program, the main idea is: dynamic cursoraccess to server time, WIN32 API function set the machine time,

the specific implementation is as follows:

Two, the realization method:

1, connect to the database

PowerBuilder supports a variety of database management system(DBMS) , such as Sybase, Oracle, Informix, Microsoft, SQL andServer etc; according to different types of databases, usingspecial interface or ODBC interface to connect to the database,a configuration file (DB Profile) .

2, create application objects, and write scripts in applicationobject events

1>, the script for the object open event is as follows:Startupfile = "settime. ini""

Sqlca.DBMS=, Prof ileString (startupfi le, "database", "DBMS","" "

Sqlca.database=Prof ileString (startupfile, "database",)

Sqlca.userid=ProfileString (startupf ile, "database",

"userid", "" ")

Sqlca.dbpass=ProfileString (startupf ile, "database",

"dbpass", "" ")

Sqlca. logid=Prof ileString (startupfile, "database", "logid","" "

Sqlca. logpass=ProfileString (startupfile, "database","LogPassWord", "" ")

Sqlca. servername=Profi leString (startupfile, database,ervername. . . )

Sqlca.dbparm=, Prof ileString (startupfile, "database","dbp arm", "" ")

Connect;

(f_setlocaltime) //call customfunction to complete the localworkstation set time

2>, the application object, the script in the Close event isas follows:

DISCONNECT Using SQLCA;

3. Define the API function of WIN32 as an external functionIn the Script brush workspace, select Declare > Global,External, Functions, and the API function defining WIN32 isdefined as an external function defined as follows:

FUNCTION LONG SetLocalTime (Ref SYSTEMTIME systimeptr) LIBRARY"Kernel32.dll""

4. Define the structure of the access time parameter

Click the Structure Painter button in PainterBar or PowerPanelto define a structure called SYSTEMTIME, which makes thestructure variables and the corresponding data type as follows:Integer wyear

Integer wmonth

Integer wdayofweek

Integer WDAY

Integer whour

Integer wminute

Integer wsecond

Integer wmillisecond

5, create user-defined functions to complete the setting ofworkstation time, this article comes from http://bianceng. cn(programming portal)

Create a custom function named f_setlocaltime with the

following script:

SYSTEMTIME s_systime//statement of previously defined typesof variables

nettime datetimedeclare cur_ time dynamic cursor for sqlsa; / /声明动态游标

/ / prepare sqlsa from "select sysdate from sys.dual"; / /oracle数据库

/ / prepare sqlsa from "select getdate()"; / / sybase数据库/ /根据实际应用, sql2000也用这个获取时间prepare sqlsa from "select now () ; / / sqlserver数据库open dynamic cur _ time;if sqlca. sqlcode = 0 thenfetch cur_ time into: nettime; / /通过数据库获取服务器时间end ifif sqlca. sqlcode < > 0 then / /获取服务器时间出错,直接使用本地时间.

/ / messagebox ("出错信息", "在函数gf _ get _ sysdate ()运行时数据库出现错误!")nett ime = datetime (today () , now ()end if

the cur _ time;it _ systime.wmonth = month (date (nettime))it _ systime.wday = day (date (nettime) )it _ systime.wyear = year (date (nettime))it _ systime.whour = hour (time (nettime))it _ systime.wminute = min (time (nettime) )it _ systime.wsecond = second (time (nettime) )it _ systime.wmillisecond = 30setlocaltime (s _ systime) / /调用win32 api函数,设置工作站时间.return nettime

6、创建可执行应用程序

在powerbar或powerpanel中单击project按钮打开project painter.select project对话框出现,单击new创建一个新的工程对象,输入可执行程序名(如: settime. exe) ,单击ok.然后单击build, 即可创建可执行文件.

7、将可执行程序安装至各工作站

将生成的可执行程序(如: settime.exe)放入各工作站的windows的启动菜单, 即可在每次启动windows时,工作站自动根据服务器时间校正本机时间.

三、结束语

上述方法是创建一个独立的可执行文件来实现工作站与服务器的时间同步;编程时,也可在应用程序的open事件或程序登录对应事件中调用上述f _ settime函数, 以实现工作站的时间与服务器同步.此方法已在开发医院信息管理系统中加以应用,取得了很好的效果.

萤光云(16元/月)高防云服务器自带50G防御

螢光云官網萤光云成立于2002年,是一家自有IDC的云厂商,主打高防云服务器产品。在国内有福州、北京、上海、台湾、香港CN2节点,还有华盛顿、河内、曼谷等海外节点。萤光云的高防云服务器自带50G防御,适合高防建站、游戏高防等业务。本次萤光云中秋云活动简单无套路,直接在原有价格上砍了一大刀,最低价格16元/月,而且有没有账户限制,新老客户都可以买,就是直接满满的诚意给大家送优惠了!官网首页:www....

wordpress公司网站模板 wordpress简洁高级通用公司主题

wordpress公司网站模板,wordpresss简洁风格的高级通用自适应网站效果,完美自适应支持多终端移动屏幕设备功能,高级可视化后台自定义管理模块+规范高效的搜索优化。wordpress公司网站模板采用标准的HTML5+CSS3语言开发,兼容当下的各种主流浏览器: IE 6+(以及类似360、遨游等基于IE内核的)、Firefox、Google Chrome、Safari、Opera等;同时...

BuyVM新设立的迈阿密机房速度怎么样?简单的测评速度性能

BuyVM商家算是一家比较老牌的海外主机商,公司设立在加拿大,曾经是低价便宜VPS主机的代表,目前为止有提供纽约、拉斯维加斯、卢森堡机房,以及新增加的美国迈阿密机房。如果我们有需要选择BuyVM商家的机器需要注意的是注册信息的时候一定要规范,否则很容易出现欺诈订单,甚至你开通后都有可能被禁止账户,也是这个原因,曾经被很多人吐槽的。这里我们简单的对于BuyVM商家新增加的迈阿密机房进行简单的测评。如...

cs服务器为你推荐
软银孙正义马云富还是孙正义富腾讯空间首页手机QQ空间首页从哪里进入!腾讯空间首页QQ空间首页是什么?p图软件哪个好用P图用什么软件啊骁龙750g和765g哪个好765g和855+比有什么优缺点?天气预报哪个好用哪个最准确手机上的天气预报软件,哪个最准,最好用?莫代尔和纯棉哪个好内裤是莫代尔的好还是棉质的好?理由是什么帕萨特和迈腾哪个好迈腾和帕萨特哪个好轿车和suv哪个好同价位的轿车和suv哪个更好?苹果手机助手哪个好苹果手机助手哪个好用些谁知道
网站空间商 海外域名注册 免费域名注册网站 成都主机租用 欧洲欧洲vps 域名抢注工具 亚洲大于500m 香港托管 unsplash http500内部服务器错误 ubuntu更新源 地址大全 南通服务器 购买国外空间 新世界服务器 美国凤凰城 英国伦敦 主机管理系统 湖南idc lamp兄弟连 更多