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

TTcloud:日本独立服务器促销活动,价格$70/月起,季付送10Mbps带宽

ttcloud怎么样?ttcloud是一家海外服务器厂商,运营服务器已经有10年时间,公司注册地址在香港地区,业务范围包括服务器托管,机柜托管,独立服务器等在内的多种服务。我们后台工单支持英文和中文服务。TTcloud最近推出了新上架的日本独立服务器促销活动,价格 $70/月起,季付送10Mbps带宽。也可以跟进客户的需求进行各种DIY定制。点击进入:ttcloud官方网站地址TTcloud拥有自...

腾讯云轻量服务器老用户续费优惠和老用户复购活动

继阿里云服务商推出轻量服务器后,腾讯云这两年对于轻量服务器的推广力度还是比较大的。实际上对于我们大部分网友用户来说,轻量服务器对于我们网站和一般的业务来说是绝对够用的。反而有些时候轻量服务器的带宽比CVM云服务器够大,配置也够好,更有是价格也便宜,所以对于初期的网站业务来说轻量服务器是够用的。这几天UCLOUD优刻得香港服务器稳定性不佳,于是有网友也在考虑搬迁到腾讯云服务器商家,对于轻量服务器官方...

六一云互联(41元)美国(24元)/香港/湖北/免费CDN/免费VPS

六一云互联六一云互联为西安六一网络科技有限公司的旗下产品。是一个正规持有IDC/ISP/CDN的国内公司,成立于2018年,主要销售海外高防高速大带宽云服务器/CDN,并以高质量.稳定性.售后相应快.支持退款等特点受很多用户的支持!近期公司也推出了很多给力的抽奖和折扣活动如:新用户免费抽奖,最大可获得500元,湖北新购六折续费八折折上折,全场八折等等最新活动:1.湖北100G高防:新购六折续费八折...

cs服务器为你推荐
腾讯空间首页手机QQ空间首页从哪里进入!租车平台哪个好共享汽车现在哪个平台的比较好?视频制作软件哪个好哪款视频编辑软件比较好用?二手车网站哪个好想买台二手车,哪个二手车网站靠谱炒股软件哪个好什么炒股软件比较好用?英语词典哪个好英语词典哪个好杰士邦和杜蕾斯哪个好杰士邦的超薄款跟杜蕾斯的超薄款,哪个舒服点?股票软件哪个好股票软件哪个好,手机股票软件哪个好用网络机顶盒哪个好现在用什么网络机顶盒最好?qq空间登录不上为什么我的QQ空间登陆不上?
下载虚拟主机 美国vps评测 如何注册网站域名 域名服务器是什么 淘宝二级域名 5折 哈喽图床 表格样式 圣诞促销 hostker 双线主机 泉州电信 国外视频网站有哪些 网站加速软件 上海电信测速 vul 百度云空间 创速 卡巴斯基官网下载 google搜索打不开 更多