当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: public static void main(string args[]) { try { string s="1"; system.out.println("len: " + s.getbytes("unicode").length); for (int i=0; i<s.getbytes("unicod......
    摘要: string ls_str ls_str=profilestring(sys_inifilename,server,server,) if trim(ls_str)="" then else if right(lower(sle_isql.text),8)<>isql.exe then/ ////////isql.ext是ms sql文件下的那个?用来干什......


客户端连接的问题。高手指教

以下是一段我客户端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中了,如何再次运行,连接数据库呢?  
 

NO.1   作者: pbtech

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)  
  这样应该可以了


    摘要: 一:既然rowsets这个接口已经能提供直接运行sql语句比如: rowset rset = new .... rset.setcommand("select * from x where...") rset.execute(); 为什么还要用 statement stmt=conn.createstatement(); stmt.executeupdate(sql);......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE