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

DiyVM:499元/月香港沙田服务器,L5630*2/16G内存/120G SSD硬盘/5M CN2线路

DiyVM是一家成立于2009年的国人主机商,提供的产品包括VPS主机、独立服务器租用等,产品数据中心包括中国香港、日本大阪和美国洛杉矶等,其中VPS主机基于XEN架构,支持异地备份与自定义镜像,VPS和独立服务器均可提供内网IP功能。商家VPS主机均2GB内存起步,三个地区机房可选,使用优惠码后每月69元起;独立服务器开设在香港沙田电信机房,CN2线路,自动化开通上架,最低499元/月起。下面以...

易探云:香港物理机服务器仅550元/月起;E3-1230/16G DDR3/SATA 1TB/香港BGP/20Mbps

易探云怎么样?易探云(yitanyun.com)是一家知名云计算品牌,2017年成立,从业4年之久,目前主要从事出售香港VPS、香港独立服务器、香港站群服务器等,在售VPS线路有三网CN2、CN2 GIA,该公司旗下产品均采用KVM虚拟化架构。目前,易探云推出免备案香港物理机服务器性价比很高,E3-1230 8 核*1/16G DDR3/SATA 1TB/香港BGP线路/20Mbps/不限流量,仅...

PhotonVPS:美国Linux VPS半价促销2.5美元/月起,可选美国洛杉矶/达拉斯/芝加哥/阿什本等四机房

photonvps怎么样?photonvps现在针对旗下美国vps推出半价促销优惠活动,2.5美元/月起,免费10Gbps DDoS防御,Linux系统,机房可选美国洛杉矶、达拉斯、芝加哥、阿什本。以前觉得老牌商家PhotonVPS贵的朋友可以先入手一个月PhotonVPS美国Linux VPS试试了。PhotonVPS允许合法大人内容,支持支付宝、paypal和信用卡,30天退款保证。Photo...

cs服务器为你推荐
视频制作软件哪个好手机短视频制作哪个软件好朗逸和速腾哪个好朗逸和新速腾哪个性能更好点?电陶炉和电磁炉哪个好电磁炉与电陶炉有啥区别,哪个更好些?网校哪个好哪个网校比较好?oppo和vivo哪个好vivo和oppo建议买哪个雅思和托福哪个好考雅思和托福哪个好考?网络机顶盒哪个好什么牌子的网络机顶盒最好云盘哪个好网盘哪个好用?qq空间登录不上为什么我的QQ空间登陆不上?willyunlee找一部关于摩托车的电影`
免费网站域名注册 com域名注册1元 哈尔滨服务器租用 西安服务器租用 vps安全设置 西安服务器 狗爹 外国服务器 国外服务器 服务器架设 租空间 789电视 网站木马检测工具 广州服务器 优酷黄金会员账号共享 shuang12 photobucket 杭州电信宽带优惠 114dns 空间服务器 更多