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

企鹅小屋:垃圾服务商有跑路风险,站长注意转移备份数据!

企鹅小屋:垃圾服务商有跑路风险!企鹅不允许你二次工单的,二次提交工单直接关服务器,再严重就封号,意思是你提交工单要小心,别因为提交工单被干了账号!前段时间,就有站长说企鹅小屋要跑路了,站长不太相信,本站平台已经为企鹅小屋推荐了几千元的业绩,CPS返利达182.67CNY。然后,站长通过企鹅小屋后台申请提现,提现申请至今已经有20几天,企鹅小屋也没有转账。然后,搞笑的一幕出现了:平台账号登录不上提示...

3C云1核1G 9.9元 4核4G 16元 美国Cera 2核4G 24元

3C云互联怎么样?3C云互联专注免备案香港美国日本韩国台湾云主机vps服务器,美国高防CN2GIA,香港CN2GIA,顶级线路优化,高端品质售后无忧!致力于对互联网云计算科技深入研发与运营的极客共同搭建而成,将云计算与网络核心技术转化为最稳定,安全,高速以及极具性价比的云服务器等产品提供给用户!专注为个人开发者用户,中小型,大型企业用户提供一站式核心网络云端服务部署,促使用户云端部署化简为零,轻松...

#消息# contabo:德国老牌机房新增美国“纽约、西雅图”数据中心,免设置费

运作了18年的德国老牌机房contabo在继去年4月开办了第一个美国数据中心(中部城市:圣路易斯)后立马在本月全新上马两个数据中心:纽约、西雅图。当前,为庆祝美国独立日,美国三个数据中心的VPS全部免除设置费,VPS本身的配置很高,价格适中,有较高的性价比!官方网站:https://contabo.com/en/SSD VPSKVM虚拟,纯SSD阵列,不限制流量,自带一个IPv4内存CPUSSD带...

cs服务器为你推荐
视频制作软件哪个好制作视频用哪个软件比较好核芯显卡与独立显卡哪个好核芯显卡和独立显卡有什么区别?最好的是哪个?oppo和vivo哪个好vivo好还是oppo手机好呢?看书软件哪个好推荐几个好用的手机看书软件网络机顶盒哪个好什么牌子的网络机顶盒最好qq空间登录器QQ空间校友网页自动登陆器群空间登录手机如何登录腾讯qq群空间YunOSyunOS是手机里的什么软件系统啊?强生美瞳月抛强生美瞳月抛有8.8基弧么什么时候买车最便宜告诉你 一年中什么时候买车最便宜
域名服务器 便宜域名注册 中文域名申请 泛域名绑定 2019年感恩节 华为云服务 buyvm 好看的桌面背景图片 免费mysql 河南移动网 umax120 服务器硬件防火墙 国外在线代理服务器 西安主机 php服务器 lamp的音标 免费蓝钻 域名转入 阿里云个人邮箱 亿库 更多