$PBExportHeader$w_outerconnection_def.srw forward global type w_outerconnection_def from w_publ_edit_index end type type cb_test_connet from uo_imflatbutton within w_outerconnection_def end type end forward global type w_outerconnection_def from w_publ_edit_index integer width = 3067 integer height = 1680 string title = "外部数据库连接设置" boolean minbox = true windowtype windowtype = popup! cb_test_connet cb_test_connet end type global w_outerconnection_def w_outerconnection_def on w_outerconnection_def.create int iCurrent call super::create this.cb_test_connet=create cb_test_connet iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_test_connet end on on w_outerconnection_def.destroy call super::destroy destroy(this.cb_test_connet) end on event ue_usual_query_filt;call super::ue_usual_query_filt;IF dw_edit_mode OR KeyDown(keyf4!) OR KeyDown(keyf5!) THEN RETURN String obj_expr = '' IF Trim(sle_usual_query.Text) <> '' THEN IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN obj_expr = obj_expr+'( connectionname like "%'+Trim(sle_usual_query.Text)+'%" )' ELSE obj_expr = obj_expr+'( connectionname like "'+Trim(sle_usual_query.Text)+'" )' END IF END IF dw_uc.SetFilter(obj_expr) dw_uc.SetRedraw(FALSE) dw_index.SetRedraw(FALSE) dw_uc.Filter() IF dw_index.RowCount() >= 1 THEN dw_index.SelectRow(0,FALSE) dw_index.SelectRow(1,TRUE) END IF dw_uc.SetRedraw(TRUE) dw_index.SetRedraw(TRUE) end event event refresh_interface;call super::refresh_interface;cb_test_connet.Enabled = NOT dw_edit_mode end event type cb_func from w_publ_edit_index`cb_func within w_outerconnection_def integer x = 987 end type type cb_exit from w_publ_edit_index`cb_exit within w_outerconnection_def integer x = 1138 end type type sle_usual_query from w_publ_edit_index`sle_usual_query within w_outerconnection_def integer x = 320 integer width = 736 end type type cb_nextpage from w_publ_edit_index`cb_nextpage within w_outerconnection_def boolean visible = false integer x = 2235 end type type cb_priorpage from w_publ_edit_index`cb_priorpage within w_outerconnection_def boolean visible = false integer x = 2071 end type type cb_firstpage from w_publ_edit_index`cb_firstpage within w_outerconnection_def boolean visible = false integer x = 1906 end type type cb_retrieveall from w_publ_edit_index`cb_retrieveall within w_outerconnection_def boolean visible = false integer x = 1742 end type type em_pagerowno from w_publ_edit_index`em_pagerowno within w_outerconnection_def boolean visible = false integer x = 1440 end type type st_pagerowno from w_publ_edit_index`st_pagerowno within w_outerconnection_def integer x = 1637 end type type st_1 from w_publ_edit_index`st_1 within w_outerconnection_def integer width = 288 string text = "连接名称含" end type type cb_add from w_publ_edit_index`cb_add within w_outerconnection_def integer x = 151 end type event cb_add::clicked;IF dw_edit_mode THEN Long row Long ll_connectionid_tmp,cnt dw_uc.AcceptText( ) row = dw_uc.GetRow( ) IF row <= 0 THEN MessageBox('提示','请选择要保存的连接',information!,OK!) RETURN END IF IF dw_uc.Object.connectionname[row] = '' THEN dw_uc.SetColumn('connectionname') MessageBox('提示','请输入连接名称',information!,OK!) RETURN END IF IF dw_uc.Object.connectiontype[row] < 0 THEN dw_uc.SetColumn('connectiontype') MessageBox('提示','请选择连接类型',information!,OK!) RETURN END IF IF dw_uc.Object.ServerName[row] = '' THEN dw_uc.SetColumn('servername') MessageBox('提示','请输入数据库名称',information!,OK!) RETURN END IF IF dw_uc.Object.databasename[row] = '' THEN dw_uc.SetColumn('databasename') MessageBox('提示','请输入服务器名称',information!,OK!) RETURN END IF IF dw_uc.Object.LogID[row] = '' THEN dw_uc.SetColumn('logid') MessageBox('提示','请输入登陆ID',information!,OK!) RETURN END IF IF dw_uc.Object.connectiontype[row] = 0 THEN ll_connectionid_tmp = dw_uc.Object.connectionid[row] SELECT count(*) INTO :cnt FROM U_OuterConnection WHERE connectiontype = 0 AND connectionid <> :ll_connectionid_tmp; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','查询是否已存在附件数据库连接失败',stopsign!,OK!) RETURN END IF IF cnt > 0 THEN MessageBox('错误','已存在附件数据库连接,不能再建立',stopsign!,OK!) RETURN END IF END IF Long ll_connectionid String arg_msg IF dw_uc.Object.connectionid[dw_uc.GetRow()] = 0 THEN ll_connectionid = f_sys_scidentity(0,"U_OuterConnection","connectionid ",arg_msg,TRUE,sqlca) IF ll_connectionid <= 0 THEN MessageBox("错误",arg_msg,stopsign!,OK!) RETURN ELSE dw_uc.Object.connectionid[dw_uc.GetRow()] = ll_connectionid END IF END IF dw_uc.AcceptText( ) END IF CALL SUPER::Clicked end event type cb_edit from w_publ_edit_index`cb_edit within w_outerconnection_def integer x = 343 end type type cb_delet from w_publ_edit_index`cb_delet within w_outerconnection_def integer x = 535 end type event cb_delet::clicked;call super::clicked;IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF dw_uc.SetRedraw (FALSE) dw_uc.DeleteRow (0) dw_uc.TriggerEvent (RowFocusChanged!) IF dw_uc.Update() = -1 THEN ROLLBACK; MessageBox ("错误","删除记录操作失败!",stopsign!,OK!) ELSE COMMIT; END IF dw_uc.SetRedraw (TRUE) WF_INDEX_UC() end event type cb_choice from w_publ_edit_index`cb_choice within w_outerconnection_def boolean visible = false integer x = 1138 integer y = 484 boolean enabled = false end type type cb_cancel from w_publ_edit_index`cb_cancel within w_outerconnection_def end type type cbx_mlselect from w_publ_edit_index`cbx_mlselect within w_outerconnection_def boolean visible = false integer x = 754 integer y = 388 boolean enabled = false end type type cbx_allselect from w_publ_edit_index`cbx_allselect within w_outerconnection_def boolean visible = false integer x = 1070 integer y = 388 boolean enabled = false end type type cb_mode_itfchg_b from w_publ_edit_index`cb_mode_itfchg_b within w_outerconnection_def end type type cb_mode_itfchg from w_publ_edit_index`cb_mode_itfchg within w_outerconnection_def integer x = 1454 end type type gb_1 from w_publ_edit_index`gb_1 within w_outerconnection_def end type type dw_uc from w_publ_edit_index`dw_uc within w_outerconnection_def integer x = 1554 integer width = 1458 integer height = 1264 string dataobject = "dw_outerconnection_edit" end type type cb_retrieve from w_publ_edit_index`cb_retrieve within w_outerconnection_def integer x = 0 end type type cb_print from w_publ_edit_index`cb_print within w_outerconnection_def boolean visible = false integer x = 942 integer y = 480 boolean enabled = false end type type ln_bar from w_publ_edit_index`ln_bar within w_outerconnection_def end type type ln_bar2 from w_publ_edit_index`ln_bar2 within w_outerconnection_def end type type r_bar from w_publ_edit_index`r_bar within w_outerconnection_def end type type ln_1 from w_publ_edit_index`ln_1 within w_outerconnection_def end type type ln_2 from w_publ_edit_index`ln_2 within w_outerconnection_def end type type dw_index from w_publ_edit_index`dw_index within w_outerconnection_def integer width = 1554 integer height = 1264 string dataobject = "dw_outerconnection_index" end type type cb_test_connet from uo_imflatbutton within w_outerconnection_def integer x = 686 integer height = 164 integer taborder = 40 boolean bringtotop = true string text = "测试连接" string normalpicname = "find.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked; Long ll_row dw_uc.AcceptText( ) ll_row = dw_uc.GetRow() IF ll_row <= 0 THEN MessageBox('提示','请选择连接',information!,OK!) RETURN END IF Transaction test_Transaction test_Transaction = CREATE Transaction test_Transaction.dbms = dw_uc.Object.dbms[ll_row] test_Transaction.Database = dw_uc.Object.DatabaseName[ll_row] test_Transaction.LogID = dw_uc.Object.LogID[ll_row] test_Transaction.LogPass = dw_uc.Object.LogPass[ll_row] test_Transaction.ServerName = dw_uc.Object.ServerName[ll_row] CONNECT USING test_Transaction; IF test_Transaction.SQLCode <> 0 THEN MessageBox('错误','连接失败,'+test_Transaction.SQLErrText,stopsign!,OK!) ELSE MessageBox('提示','连接成功',information!,OK!) END IF DISCONNECT USING test_Transaction; end event