$PBExportHeader$w_set_server.srw forward global type w_set_server from w_publ_base end type type st_7 from statictext within w_set_server end type type sle_server from singlelineedit within w_set_server end type type st_5 from statictext within w_set_server end type type sle_logid from singlelineedit within w_set_server end type type st_6 from statictext within w_set_server end type type sle_logpass from singlelineedit within w_set_server end type type cb_ok from uo_imflatbutton within w_set_server end type type cb_connect from uo_imflatbutton within w_set_server end type type gb_1 from groupbox within w_set_server end type end forward global type w_set_server from w_publ_base integer width = 2263 integer height = 676 string title = "服务器设置" boolean minbox = false windowtype windowtype = response! long backcolor = 16777215 boolean center = true st_7 st_7 sle_server sle_server st_5 st_5 sle_logid sle_logid st_6 st_6 sle_logpass sle_logpass cb_ok cb_ok cb_connect cb_connect gb_1 gb_1 end type global w_set_server w_set_server type variables long ins_ifguid = 0 long ins_rslt = 0 end variables on w_set_server.create int iCurrent call super::create this.st_7=create st_7 this.sle_server=create sle_server this.st_5=create st_5 this.sle_logid=create sle_logid this.st_6=create st_6 this.sle_logpass=create sle_logpass this.cb_ok=create cb_ok this.cb_connect=create cb_connect this.gb_1=create gb_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_7 this.Control[iCurrent+2]=this.sle_server this.Control[iCurrent+3]=this.st_5 this.Control[iCurrent+4]=this.sle_logid this.Control[iCurrent+5]=this.st_6 this.Control[iCurrent+6]=this.sle_logpass this.Control[iCurrent+7]=this.cb_ok this.Control[iCurrent+8]=this.cb_connect this.Control[iCurrent+9]=this.gb_1 end on on w_set_server.destroy call super::destroy destroy(this.st_7) destroy(this.sle_server) destroy(this.st_5) destroy(this.sle_logid) destroy(this.st_6) destroy(this.sle_logpass) destroy(this.cb_ok) destroy(this.cb_connect) destroy(this.gb_1) end on event open;call super::open;sle_logid.Text = ProfileString (sys_inifilename, "database", "logid", "SA") sle_logpass.Text = f_psw_bczh(ProfileString (sys_inifilename, "database", "LogPassWord", ""),1,sys_power_key) sle_server.Text = ProfileString (sys_inifilename, "database", "servername", "127.0.0.1") IF sle_server.Text = "" THEN sle_server.Text = "127.0.0.1" END IF IF sle_logid.Text = "" THEN sle_logid.Text = "SA" END IF ins_ifguid = Message.DoubleParm IF IsNull(ins_ifguid) THEN ins_ifguid = 0 IF ins_ifguid = 1 THEN This.Title = '1.' + This.Title gb_1.Text = '1.' + This.gb_1.Text cb_ok.Text = '下一步' cb_ok.normalpicname = 'p6.bmp' cb_ok.of_init_draw() cb_ok.of_paint() cb_ok.TriggerEvent('ue_textchange') END IF end event event close;call super::close;closewithreturn(this, ins_rslt) end event type cb_func from w_publ_base`cb_func within w_set_server boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_set_server integer x = 1838 integer y = 472 end type type st_7 from statictext within w_set_server integer x = 146 integer y = 128 integer width = 256 integer height = 60 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 long backcolor = 16777215 boolean enabled = false string text = "服务器:" alignment alignment = right! boolean focusrectangle = false end type type sle_server from singlelineedit within w_set_server integer x = 416 integer y = 116 integer width = 1655 integer height = 80 integer taborder = 130 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type st_5 from statictext within w_set_server integer x = 146 integer y = 228 integer width = 256 integer height = 60 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 long backcolor = 16777215 boolean enabled = false string text = "登录 ID:" alignment alignment = right! boolean focusrectangle = false end type type sle_logid from singlelineedit within w_set_server integer x = 416 integer y = 216 integer width = 1655 integer height = 80 integer taborder = 140 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type st_6 from statictext within w_set_server integer x = 146 integer y = 320 integer width = 256 integer height = 60 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 long backcolor = 16777215 boolean enabled = false string text = "登录 口令:" alignment alignment = right! boolean focusrectangle = false end type type sle_logpass from singlelineedit within w_set_server integer x = 416 integer y = 312 integer width = 1655 integer height = 80 integer taborder = 150 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 boolean autohscroll = false boolean password = true borderstyle borderstyle = stylelowered! end type type cb_ok from uo_imflatbutton within w_set_server integer x = 1426 integer y = 472 integer width = 311 integer height = 96 integer taborder = 20 boolean bringtotop = true string normalpicname = "ok.bmp" end type event clicked;call super::clicked;SetProfileString (sys_inifilename, "database", "logid", sle_logid.Text) SetProfileString (sys_inifilename, "database", "LogPassWord", f_psw_bczh(sle_logpass.Text,0,sys_power_key)) SetProfileString (sys_inifilename, "database", "servername", sle_server.Text) ins_rslt = 1 close(parent) end event type cb_connect from uo_imflatbutton within w_set_server integer x = 283 integer y = 472 integer width = 315 integer height = 96 integer taborder = 90 boolean bringtotop = true string text = "测试连接" end type event clicked;call super::clicked;IF Trim(sle_server.Text) = '' THEN MessageBox('系统提示','请输入服务器!',information!,OK!) RETURN END IF IF Trim(sle_logid.Text) = '' THEN MessageBox('系统提示','请输入登陆ID!',information!,OK!) RETURN END IF string ls_database = "master" Open(w_sys_wait) w_sys_wait.wf_set_msg("正在尝试连接数据库,此过程预计需要用时1分钟...") Transaction db_Transaction db_Transaction = Create Transaction db_Transaction.DBMS = "SNC SQL Native Client(OLE DB)" db_Transaction.Database = ls_database db_Transaction.UserID = sle_logid.Text db_Transaction.DBPass = sle_logpass.Text db_Transaction.LogID = sle_logid.Text db_Transaction.LogPass = sle_logpass.Text db_Transaction.ServerName = sle_server.Text db_Transaction.Lock = "RU" db_Transaction.AutoCommit = False db_Transaction.DBParm = "Database= '" + ls_database + "',PBTrimCharColumns='YES'" CONNECT Using db_Transaction; Int rslt = 1 String arg_msg = '' IF db_Transaction.SQLCode < 0 THEN rslt = 0 arg_msg = "连接数据库失败!" IF Pos(db_Transaction.SQLErrText, "'"+sle_logid.Text+"'") > 0 THEN arg_msg = arg_msg + "用户密码错误!" sle_logpass.SetFocus() else arg_msg = arg_msg + "用户密码错误!~r~n"+db_Transaction.SQLErrText END IF IF Pos(db_Transaction.SQLErrText, "'"+ls_database+"'") > 0 THEN rslt = 1 END IF ELSE rslt = 1 END IF DISCONNECT Using db_Transaction; Destroy db_Transaction; Close(w_sys_wait) IF rslt = 0 THEN MessageBox("系统提示",arg_msg) ELSE MessageBox("系统提示","连接数据库成功!") END IF end event type gb_1 from groupbox within w_set_server integer x = 18 integer y = 48 integer width = 2217 integer height = 388 integer taborder = 270 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "服务器设置" end type