工作站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函数, 以实现工作站的时间与服务器同步.此方法已在开发医院信息管理系统中加以应用,取得了很好的效果.

NameSilo域名优惠码活动

NameSilo是通过之前的感恩节优惠活动中认识到这家注册商的,于是今天早上花了点时间专门了解了NameSilo优惠码和商家的详细信息。该商家只销售域名,他们家的域名销售价格还是中规中矩的,没有像godaddy域名标价和使用优惠之后的价格悬殊很大,而且其特色就是该域名平台提供免费的域名停放、免费隐私保护等功能。namesilo新注册域名价格列表,NameSilo官方网站:www.namesilo....

Atcloud:全场8折优惠,美国/加拿大/英国/法国/德国/新加坡vps,500g大硬盘/2T流量/480G高防vps,$4/月

atcloud怎么样?atcloud刚刚发布了最新的8折优惠码,该商家主要提供常规cloud(VPS)和storage(大硬盘存储)系列VPS,其数据中心分布在美国(俄勒冈、弗吉尼亚)、加拿大、英国、法国、德国、新加坡,所有VPS默认提供480Gbps的超高DDoS防御。Atcloud高防VPS。atcloud.net,2020年成立,主要提供基于KVM虚拟架构的VPS、只能DNS解析、域名、SS...

美国高防云服务器 1核 1G 26元/月 香港/日本站群服务器 E5 16G 1600元/月 触摸云

触摸云国内IDC/ISP资质齐全商家,与香港公司联合运营, 已超8年运营 。本次为大家带来的是双12特惠活动,美国高防|美国大宽带买就可申请配置升档一级[CPU内存宽带流量选一]升档方式:CPU内存宽带流量任选其一,工单申请免费升级一档珠海触摸云科技有限公司官方网站:https://cmzi.com/可新购免费升档配置套餐:地区CPU内存带宽数据盘价格购买地址美国高防 1核 1G10M20G 26...

cs服务器为你推荐
金士顿内存卡怎么样金士顿内存好吗?可爱桌面背景图片求好看的桌面背景图片天玑1000plus和骁龙865哪个好天玑1000plus相当于骁龙多少浮动利率和固定利率哪个好房贷利率是固定的还是浮动的好?绝地求生加速器哪个好绝地求生的加速器哪个好用?无纺布和熔喷布口罩哪个好活性碳口罩和无纺布口罩有什么不同?手机杀毒哪个好手机杀毒软件哪个好 五大手机安全软件杀毒大比拼尼康和佳能单反哪个好佳能和尼康哪个好qq空间登录QQ页面上空间不能登陆了,怎么回事?51空间登录51空间怎么进
php网站空间 中国域名交易中心 购买域名和空间 ipage lamp edgecast shopex空间 华为云主机 灵动鬼影 怎样建立邮箱 卡巴斯基是免费的吗 web服务器搭建 1元域名 restart 什么是dns e-mail 删除域名 美国vpn服务器 神棍节 大硬盘分区 更多