判断网络连接错误和数据窗口速度极慢

zqyuen 2010-04-19 08:28:27
//声明的外部函数
Function ulong IcmpCreateFile () Library "icmp.dll"
Function long IcmpSendEcho (ulong IcmpHandle, ulong DestinationAddress, string RequestData,long RequestSize, long RequestOptions, Ref icmp_echo_reply ReplyBuffer, long ReplySize, long Timeout ) Library "icmp.dll" Alias for "IcmpSendEcho"
Function long IcmpCloseHandle (ulong IcmpHandle) Library "icmp.dll"
Function ulong inet_addr (string cp) Library "ws2_32.dll" Alias for "inet_addr"


//判断有无连接网络
string ls_ip
int li_value
ls_ip=profilestring("ping.INI","target","IPAddr","")
ls_ip=STRING(f_ipaddressany(ls_ip))
of_ping(ls_ip)//自己定义的ping函数,使用了icmp.dll中的IcmpCreateFile ()、IcmpSendEcho 、IcmpCloseHandle
if ProfileString("ping.INI", "properties", "Result","None")="Ping Successful" then
li_value=messagebox("提示","网络已连接,是否更新信息",exclamation!,yesno!)
if li_value=1 then
string ls_DBParm
ls_DBParm=profilestring(gs_IniFile,"DataBaseSQL","DBParm","")
ls_DBParm=f_decryption(ls_DBParm)

datetime ld_endtime,ld_today
int li_Return
transaction mytrans1
mytrans1=create transaction
mytrans1.DBMS = "ODBC"
mytrans1.AutoCommit = False
mytrans1.DBParm = ls_DBParm
connect using mytrans1;
open(w_popwin)
if mytrans1.sqlcode= 0 then
select endtime,getdate() into :ld_endtime,:ld_today
from t_user
where userid=:gs_user and clientid=:gs_clientid commit using mytrans1;
if ld_today<=ld_endtime then
if not f_updateonline(mytrans1)=1 then
messagebox("提示","数据更新失败")
end if
else
messagebox("提示","系统授权时间已经到期,无法再更新信息!")
end if
else
messagebox("提示","无法连接数据库!")
end if
close(w_popwin)
disconnect using mytrans1;
destroy mytrans1;
elseif li_value=2 then
OpenSheet(w__add,this,0,Original!)
end if
end if



1)如果把外部的函数作为全局外部函数,系统会报一个用户对象中的SelectObject()错误,然后自动退出pb;如果作为局部外部函数,运行时不会报错,当执行上述代码时可能马上报一个pb80.exe没有处理的win32异常,然后显示是否调试(我装了sql server2005)对话框,选否,退出pb;也可能本次进入程序,在操作期间发生同样的错误;或者本次不发生,在下次进入软件时一定发生。
如果把判断网络连接的代码去掉,则不会出现此类问题,请问是什么原因???请教高手!!!

2)程序中的一些freedom数据窗口存放大量的文本(达到将近五千个汉字),并且程序调整了绘制表格线和列的位置,在打开次数据窗口时速度很慢,且读取硬盘的声音很响;界面启动后如果拖动数据窗口的滚动条同样出现读盘的声音,且明显速度很慢。
请问是什么原因,解决办法又有什么样的解决办法呢?

请教各位高手,谢谢!!!


判断网络连接错误和数据窗口速度极慢
...全文
108 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zqyuen 2010-04-20
  • 打赏
  • 举报
回复
等待回答,自己顶!
tiantianxiaoqiang 2010-04-20
  • 打赏
  • 举报
回复
偶见过有人不停的写查询语句,如果返回慢了,就认为以和服务器断开
winwhere 2010-04-20
  • 打赏
  • 举报
回复
也想做个这样的东西,但没有好的思路,程序运行时判断网络有无连接,是连接到数据库,如果后台断开了,则提示,显示一个断开的图片,如有没有,则显示连接的图片。
永生天地 2010-04-20
  • 打赏
  • 举报
回复
最后帮顶

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧