以下是一段我客户端application中open代码:
string str_host
str_host=profilestring("set.ini","profile gsgl","servername","")//从.ini中取服务器的ip地址
if len(str_host)=0 then//如果为空就打开一个输入框窗口,输入
open(w_sethost)
end if
SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
SQLCA.Database = "sfxt"
SQLCA.ServerName = str_host
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
connect using sqlca;
if sqlca.sqlcode<0 then
messagebox("不能连接到数据库!",sqlca.sqlerrtext,stopsign!,ok!)
end if
open(w_login)
我的问题是如何判断此ip地址是否有效,当ip无效时,似乎会产生当机
还有就是在w_sethost中输入了ip后,程序已经运行在了application的open中了,如何再次运行,连接数据库呢?
if len(str_host)=0 then//如果为空就打开一个输入框窗口,输入
open(w_sethost)
end if
在w_sethost上放singledit的控件,用来输入服务器名,再放一个button
在button的click事件中
SetProfileString("set.ini","profile gsgl","servername",sle_dbms.Text)
MESSAGEBOX(,设置保存完成!系统必须重起!)
close(parent)
这样应该可以了