$PBExportHeader$w_set_sqlca_ecl.srw $PBExportComments$数据库连接窗口 forward global type w_set_sqlca_ecl from w_publ_base end type type cb_ok from uo_imflatbutton within w_set_sqlca_ecl end type type sle_logpass from singlelineedit within w_set_sqlca_ecl end type type sle_logid from singlelineedit within w_set_sqlca_ecl end type type sle_server from singlelineedit within w_set_sqlca_ecl end type type sle_database from singlelineedit within w_set_sqlca_ecl end type type sle_dbpass from singlelineedit within w_set_sqlca_ecl end type type sle_userid from singlelineedit within w_set_sqlca_ecl end type type sle_dbparm from singlelineedit within w_set_sqlca_ecl end type type st_9 from statictext within w_set_sqlca_ecl end type type st_6 from statictext within w_set_sqlca_ecl end type type st_5 from statictext within w_set_sqlca_ecl end type type st_4 from statictext within w_set_sqlca_ecl end type type st_3 from statictext within w_set_sqlca_ecl end type type st_2 from statictext within w_set_sqlca_ecl end type type st_00 from statictext within w_set_sqlca_ecl end type type st_7 from statictext within w_set_sqlca_ecl end type type sle_dbms from dropdownlistbox within w_set_sqlca_ecl end type type st_2334 from statictext within w_set_sqlca_ecl end type type st_345 from statictext within w_set_sqlca_ecl end type type sle_sqldb_mdf_sor from singlelineedit within w_set_sqlca_ecl end type type sle_sqldb_ldf_sor from singlelineedit within w_set_sqlca_ecl end type type st_jd from statictext within w_set_sqlca_ecl end type type st_1 from statictext within w_set_sqlca_ecl end type type sle_bookname from singlelineedit within w_set_sqlca_ecl end type type sle_fjname from singlelineedit within w_set_sqlca_ecl end type type cb_ch3 from commandbutton within w_set_sqlca_ecl end type type cb_1 from commandbutton within w_set_sqlca_ecl end type type st_11 from statictext within w_set_sqlca_ecl end type type ddlb_1 from dropdownlistbox within w_set_sqlca_ecl end type type st_12 from statictext within w_set_sqlca_ecl end type type rb_1 from radiobutton within w_set_sqlca_ecl end type type rb_2 from radiobutton within w_set_sqlca_ecl end type type sle_filename from singlelineedit within w_set_sqlca_ecl end type type cb_ch2 from commandbutton within w_set_sqlca_ecl end type type st_13 from statictext within w_set_sqlca_ecl end type type sle_folder from singlelineedit within w_set_sqlca_ecl end type type cb_2 from commandbutton within w_set_sqlca_ecl end type type cbx_modify from checkbox within w_set_sqlca_ecl end type type st_8 from statictext within w_set_sqlca_ecl end type type cbx_fj from checkbox within w_set_sqlca_ecl end type type st_10 from statictext within w_set_sqlca_ecl end type type cbx_yj from checkbox within w_set_sqlca_ecl end type type sle_yjname from singlelineedit within w_set_sqlca_ecl end type type cb_ch4 from commandbutton within w_set_sqlca_ecl end type type cb_connect from uo_imflatbutton within w_set_sqlca_ecl end type type gb_1 from groupbox within w_set_sqlca_ecl end type type gb_2 from groupbox within w_set_sqlca_ecl end type type gb_3 from groupbox within w_set_sqlca_ecl end type end forward global type w_set_sqlca_ecl from w_publ_base integer x = 283 integer y = 12 integer width = 2272 integer height = 1632 string title = "初始化帐套设定" boolean minbox = false windowtype windowtype = response! long backcolor = 16777215 cb_ok cb_ok sle_logpass sle_logpass sle_logid sle_logid sle_server sle_server sle_database sle_database sle_dbpass sle_dbpass sle_userid sle_userid sle_dbparm sle_dbparm st_9 st_9 st_6 st_6 st_5 st_5 st_4 st_4 st_3 st_3 st_2 st_2 st_00 st_00 st_7 st_7 sle_dbms sle_dbms st_2334 st_2334 st_345 st_345 sle_sqldb_mdf_sor sle_sqldb_mdf_sor sle_sqldb_ldf_sor sle_sqldb_ldf_sor st_jd st_jd st_1 st_1 sle_bookname sle_bookname sle_fjname sle_fjname cb_ch3 cb_ch3 cb_1 cb_1 st_11 st_11 ddlb_1 ddlb_1 st_12 st_12 rb_1 rb_1 rb_2 rb_2 sle_filename sle_filename cb_ch2 cb_ch2 st_13 st_13 sle_folder sle_folder cb_2 cb_2 cbx_modify cbx_modify st_8 st_8 cbx_fj cbx_fj st_10 st_10 cbx_yj cbx_yj sle_yjname sle_yjname cb_ch4 cb_ch4 cb_connect cb_connect gb_1 gb_1 gb_2 gb_2 gb_3 gb_3 end type global w_set_sqlca_ecl w_set_sqlca_ecl type prototypes Subroutine Sleep(ulong dwMilliseconds) LIBRARY "kernel32.dll" Function long ShellExecuteA (long hwnd, string lpOperation ,String lpFile, String lpParameters, String lpDirectory, Long nShowCmd) Library "shell32.dll" alias for "ShellExecuteA;Ansi" Function long GetFullPathName (String lpFileName ,Long nBufferLength,ref string lpBuffer,ref long lpFilePart) library "kernel32" ALIAS FOR "GetFullPathNameA;Ansi" end prototypes type variables INT ARROWADDNEW string ls_bat_filename='_ls_cmd_run.bat' string ls_txt_filename='_ls_cmd_rslt.txt' string masterpath string mssqlpath boolean lb_more = false string is_bookcode = '01' end variables forward prototypes public function integer wf_findisql () public function integer wf_buildsqldb (ref string arg_msg) public subroutine wf_facechange () public function integer wf_chk_database (string arg_databasename, transaction arg_transaction) public function integer wf_drop_database (string arg_databasename, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg) public function integer wf_create_database (string arg_folder, string arg_databasename, string arg_filename, string arg_sqldb_mdf_sor, string arg_sqldb_ldf_sor, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg) end prototypes public function integer wf_findisql ();//wf_findisql IF FileExists('c:\mssql7\data\master.mdf') THEN mssqlpath = 'c:\mssql7\data\' GOTO ext END IF IF FileExists('c:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN mssqlpath = 'c:\Program Files\Microsoft SQL Server\data\' GOTO ext END IF IF FileExists('c:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN mssqlpath = "c:\Program Files\Microsoft SQL Server\MSSQL\data\" GOTO ext END IF IF FileExists('d:\mssql7\data\master.mdf') THEN mssqlpath = 'd:\mssql7\data\' GOTO ext END IF IF FileExists('d:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN mssqlpath = 'd:\Program Files\Microsoft SQL Server\data\' GOTO ext END IF IF FileExists('d:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN mssqlpath = 'd:\Program Files\Microsoft SQL Server\MSSQL\data\' GOTO ext END IF IF FileExists('e:\mssql7\data\master.mdf') THEN mssqlpath = 'e:\mssql7\data\' GOTO ext END IF IF FileExists('e:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN mssqlpath = 'e:\Program Files\Microsoft SQL Server\data\' GOTO ext END IF IF FileExists('e:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN mssqlpath = 'e:\Program Files\Microsoft SQL Server\MSSQL\data\' GOTO ext END IF IF FileExists('f:\mssql7\data\master.mdf') THEN mssqlpath = 'f:\mssql7\data\' GOTO ext END IF IF FileExists('f:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN mssqlpath = 'f:\Program Files\Microsoft SQL Server\data\' GOTO ext END IF IF FileExists('f:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN mssqlpath = 'f:\Program Files\Microsoft SQL Server\MSSQL\data\' GOTO ext END IF IF FileExists('g:\mssql7\data\master.mdf') THEN mssqlpath = 'g:\mssql7\data\' GOTO ext END IF IF FileExists('g:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN mssqlpath = 'g:\Program Files\Microsoft SQL Server\data\' GOTO ext END IF IF FileExists('g:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN mssqlpath = 'g:\Program Files\Microsoft SQL Server\MSSQL\data\' GOTO ext END IF IF FileExists('h:\mssql7\data\master.mdf') THEN mssqlpath = 'h:\mssql7\data\' GOTO ext END IF IF FileExists('h:\Program Files\Microsoft SQL Server\80\data\master.mdf') THEN mssqlpath = 'h:\Program Files\Microsoft SQL Server\data\' GOTO ext END IF IF FileExists('h:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') THEN mssqlpath = 'h:\Program Files\Microsoft SQL Server\MSSQL\data\' GOTO ext END IF IF FileExists('d:\Program Files\MSDE\MSSQL\data\master.mdf') THEN mssqlpath = 'd:\Program Files\MSDE\MSSQL\data\' GOTO ext END IF ext: IF mssqlpath = '' THEN mssqlpath = "c:\Program Files\Microsoft SQL Server\MSSQL\data\" RETURN 0 end function public function integer wf_buildsqldb (ref string arg_msg);//wf_buildsqldb Integer li_FileNum,rslt = 1 String comm,msg Long i,j,lu_return String ls_test String ls_dat String ls_databasename String ls_filename Transaction db_Transaction db_Transaction = Create Transaction Open(w_sys_wait) IF Trim(sle_folder.Text) = '' THEN arg_msg = '请输入目标文件路径!' rslt = 0 GOTO ext END IF Int ll_result ll_result = createdirectory(sle_folder.Text) //IF ll_result = -1 THEN // arg_msg = '目标文件路径创建失败!' // rslt = 0 // GOTO ext //END IF ls_dat = sle_filename.Text IF Not FileExists ( ls_dat ) THEN arg_msg = "主数据库文件不存在!" rslt = 0 GOTO ext END IF IF rb_1.Checked THEN ls_dat = Trim(sle_fjname.Text) IF Not FileExists ( ls_dat ) THEN arg_msg = "附件数据库文件不存在!" rslt = 0 GOTO ext END IF END IF IF cbx_yj.Checked THEN ls_dat = Trim(sle_yjname.Text) IF Not FileExists ( ls_dat ) THEN arg_msg = "邮件数据库文件不存在!" rslt = 0 GOTO ext END IF END IF w_sys_wait.wf_set_msg("正在尝试新建数据库,此过程预计需要用时1分钟...") db_Transaction.DBMS = "SNC SQL Native Client(OLE DB)" db_Transaction.Database = 'master' db_Transaction.UserID = ProfileString (sys_inifilename, "database", "userid", "") db_Transaction.DBPass = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbpass", ""),1,sys_power_key) 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= 'master' ,PBTrimCharColumns='YES'" IF db_Transaction.Database = '' Or db_Transaction.ServerName = '' THEN arg_msg = "连接数据库失败!" rslt = 0 GOTO ext END IF CONNECT Using db_Transaction; db_Transaction.AutoCommit = True IF db_Transaction.SQLCode <> 0 THEN DISCONNECT Using db_Transaction; arg_msg = '服务器连接失败!!' rslt = 0 GOTO ext END IF //检查主数据库 ls_databasename = Trim(sle_database.Text) IF wf_chk_database(ls_databasename, db_Transaction) = 1 THEN IF MessageBox ("询问","主数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN rslt = 2 GOTO ext ELSE IF wf_drop_database(ls_databasename, db_Transaction, False, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF END IF END IF //检查附件数据库 ls_databasename = Trim(sle_database.Text)+ '_fj' IF wf_chk_database(ls_databasename, db_Transaction) = 1 THEN IF MessageBox ("询问","附件数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN rslt = 2 GOTO ext ELSE IF wf_drop_database(ls_databasename, db_Transaction, False, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF END IF END IF //检查邮件数据库 ls_databasename = Trim(sle_database.Text) + '_yj' IF wf_chk_database(ls_databasename, db_Transaction) = 1 THEN IF MessageBox ("询问","邮件数据库已存在,是否确定要覆盖?",Question!,YesNo! ) = 2 THEN rslt = 2 GOTO ext ELSE IF wf_drop_database(ls_databasename, db_Transaction, False, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF END IF END IF //新建主数据库 ls_databasename = Trim(sle_database.Text) ls_filename = Trim(sle_filename.Text) st_jd.Text = '正在新建主数据库' IF wf_create_database(sle_folder.Text, ls_databasename, ls_filename, sle_sqldb_mdf_sor.Text, sle_sqldb_ldf_sor.Text, db_Transaction, false, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //新建附件数据库 IF cbx_fj.Checked THEN ls_databasename = Trim(sle_database.Text)+ '_fj' ls_filename = Trim(sle_fjname.Text) st_jd.Text = '正在新建附件数据库' IF wf_create_database(sle_folder.Text, ls_databasename, ls_filename, 'filemanage_Data', 'filemanage_Log', db_Transaction, false, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF String ls_MDF,ls_ldf ls_MDF = ls_databasename + ".MDF" ls_ldf = ls_databasename + ".ldf" comm = "INSERT INTO " + Trim(sle_database.Text) + ".dbo.U_OuterConnection ("+& "ConnectionID ,"+& "DBMS ,"+& "ConnectionName ,"+& "ConnectionType ,"+& "DataBaseName ,"+& "ServerName ,"+& "LogId ,"+& "LogPass ,"+& "mdf_name ,"+& "ldf_name ,"+& "opdate"+& ")"+& "VALUES"+& "("+& "11,"+& "'MSS Microsoft SQL Server 6.x',"+& "'附件数据库',"+& "0,"+& "'" + ls_databasename + "',"+& "'" + db_Transaction.ServerName+"',"+& "'" + db_Transaction.LogID + "',"+& "'" + db_Transaction.LogPass + "',"+& "'" + ls_MDF + "',"+& "'" + ls_ldf + "',"+& "getdate()"+& ");" EXECUTE Immediate :comm Using db_Transaction; IF db_Transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '设置附件数据库连接失败,请手动设置' GOTO ext END IF END IF //新建邮件数据库 IF cbx_yj.Checked THEN ls_databasename = Trim(sle_database.Text) + '_yj' ls_filename = Trim(sle_yjname.Text) st_jd.Text = '正在新建邮件数据库' IF wf_create_database(sle_folder.Text, ls_databasename, ls_filename, 'filemanage_Data', 'filemanage_Log', db_Transaction, false, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF ls_MDF = ls_databasename + ".MDF" ls_ldf = ls_databasename + ".ldf" comm = "INSERT INTO " + Trim(sle_database.Text) + ".dbo.U_OuterConnection ("+& "ConnectionID ,"+& "DBMS ,"+& "ConnectionName ,"+& "ConnectionType ,"+& "DataBaseName ,"+& "ServerName ,"+& "LogId ,"+& "LogPass ,"+& "mdf_name ,"+& "ldf_name ,"+& "opdate"+& ")"+& "VALUES"+& "("+& "12,"+& "'MSS Microsoft SQL Server 6.x',"+& "'邮件数据库',"+& "2,"+& "'" + ls_databasename + "',"+& "'" + db_Transaction.ServerName+"',"+& "'" + db_Transaction.LogID + "',"+& "'" + db_Transaction.LogPass + "',"+& "'" + ls_MDF + "',"+& "'" + ls_ldf + "',"+& "getdate()"+& ");" EXECUTE Immediate :comm Using db_Transaction; IF db_Transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '设置邮件数据库连接失败,请手动设置' GOTO ext END IF END IF ext: w_sys_wait.Hide() Close(w_sys_wait) IF rslt = 1 THEN COMMIT Using db_Transaction; ELSE ROLLBACK Using db_Transaction; END IF DISCONNECT Using db_Transaction; Destroy db_Transaction RETURN rslt end function public subroutine wf_facechange ();//IF rb_2.Checked THEN // ddlb_1.Enabled = False // cbx_modify.Enabled = False // sle_filename.Enabled = False // cb_ch2.Enabled = False // sle_fjname.Enabled = False // cb_ch3.Enabled = False // sle_folder.Enabled = False // cb_2.Enabled = False // cbx_fj.Enabled = False // st_1.Enabled = False // st_12.Enabled = False // st_8.Enabled = False // st_13.Enabled = False // cbx_yj.Enabled = False // sle_yjname.Enabled = False // cb_ch4.Enabled = False // // This.Height = 780 // cb_1.Text = '︾' // // gb_1.Visible = False // st_7.Visible = False // sle_server.Visible = False // st_5.Visible = False // sle_logid.Visible = False // st_6.Visible = False // sle_logpass.Visible = False // // cb_ok.Y = 532 // cb_exit.Y = 532 //ELSE // //END IF IF rb_2.Checked THEN ddlb_1.Enabled = False cbx_modify.Enabled = False sle_filename.Enabled = False cb_ch2.Enabled = False sle_fjname.Enabled = False cb_ch3.Enabled = False sle_folder.Enabled = False cb_2.Enabled = False cbx_fj.Enabled = False st_1.Enabled = False st_12.Enabled = False st_8.Enabled = False st_13.Enabled = False cbx_yj.Enabled = False sle_yjname.Enabled = False cb_ch4.Enabled = False ELSE ddlb_1.Enabled = True cbx_modify.Enabled = True END IF IF cb_1.Text = '︽' THEN This.Height = 1700 //PARENT.Height + 1000 //cb_1.Text = '︽' gb_1.Visible = True st_7.Visible = True sle_server.Visible = True st_5.Visible = True sle_logid.Visible = True st_6.Visible = True sle_logpass.Visible = True cb_ok.Y = 1436 cb_exit.Y = 1436 cb_connect.Y = 1436 ELSE This.Height = 780 //PARENT.Height - 1000 //cb_1.Text = '︾' gb_1.Visible = False st_7.Visible = False sle_server.Visible = False st_5.Visible = False sle_logid.Visible = False st_6.Visible = False sle_logpass.Visible = False cb_ok.Y = 532 cb_exit.Y = 532 cb_connect.Y = 532 END IF end subroutine public function integer wf_chk_database (string arg_databasename, transaction arg_transaction);String ls_test ls_test = "if exists(select 1 from master..sysdatabases where name='" + arg_databasename + "') raiserror('Database existed',18,1) else raiserror('Database not existed',18,1) " EXECUTE Immediate :ls_test Using arg_transaction; IF pos(arg_transaction.SQLErrText , 'Database existed' ) > 0 THEN RETURN 1 ELSE RETURN 0 END IF end function public function integer wf_drop_database (string arg_databasename, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1 String comm comm = " IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'" + arg_databasename + "') DROP DATABASE [" + arg_databasename + "]" EXECUTE Immediate :comm Using arg_Transaction; IF arg_Transaction.SQLCode <> 0 THEN arg_msg = '删除数据库失败,请手动删除['+arg_databasename+']>'+arg_Transaction.SQLErrText rslt = 0 ELSE rslt = 1 END IF IF rslt = 0 THEN ROLLBACK Using arg_Transaction; ELSEIF arg_ifcommit THEN COMMIT Using arg_Transaction; END IF RETURN rslt end function public function integer wf_create_database (string arg_folder, string arg_databasename, string arg_filename, string arg_sqldb_mdf_sor, string arg_sqldb_ldf_sor, transaction arg_transaction, boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1 String comm comm = ' create DATABASE '+arg_databasename+& " on(name='"+arg_sqldb_mdf_sor+"',FILENAME= '"+arg_folder + '\' + arg_databasename+'_data.ldf'+"') log on (name='"+arg_sqldb_ldf_sor+"',FILENAME= '"+arg_folder + '\' + arg_databasename+'_log.ldf'+"')" EXECUTE Immediate :comm Using arg_transaction; IF arg_transaction.SQLCode <> 0 THEN arg_msg = '建立数据库['+arg_databasename+']失败,请手动建立及恢复>'+arg_transaction.SQLErrText rslt = 0 GOTO ext END IF // st_jd.Text = '正在恢复主数据库...' comm = 'RESTORE DATABASE '+arg_databasename+" from DISK= '"+arg_filename+"'"+& " WITH MOVE '"+arg_sqldb_mdf_sor+"' TO '"+arg_folder + '\' + arg_databasename+'_data.ldf'+"',"+& " MOVE '"+arg_sqldb_ldf_sor+"' TO '"+arg_folder + '\' + arg_databasename+'_log.ldf'+"',"+'REPLACE' EXECUTE Immediate :comm Using arg_transaction; IF arg_transaction.SQLCode <> 0 THEN arg_msg = '恢复数据库['+arg_databasename+']失败,请手动恢复>'+arg_transaction.SQLErrText rslt = 0 END IF ext: IF rslt = 0 THEN ROLLBACK Using arg_transaction; ELSEIF arg_ifcommit THEN COMMIT Using arg_transaction; END IF RETURN rslt end function event open;call super::open;// Open script for W_SET_SQLCA //ARROWADDNEW = Message.DoubleParm is_bookcode = Message.StringParm IF IsNull(is_bookcode) THEN is_bookcode = '01' IF is_bookcode = '' THEN is_bookcode = '01' IF sys_cur_path = "" THEN Long rslt = 1 String lpBuffer lpBuffer = Fill('',200) Long lpfilepart,li_FileNum rslt = GetFullPathName(sys_inifilename,196,lpBuffer,lpfilepart) sys_cur_path = Left(lpBuffer,Len(lpBuffer)-Len(sys_inifilename)) END IF sle_dbms.Text = ProfileString (sys_inifilename, "database", "dbms", "") sle_database.Text = ProfileString (sys_inifilename, "database", "database", "") sle_userid.Text = ProfileString (sys_inifilename, "database", "userid", "") sle_dbpass.Text = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbpass", ""),1,sys_power_key) 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", "") sle_dbparm.Text = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbparm", ""),1,sys_power_key) sle_bookname.Text = ProfileString (sys_inifilename, "database", "bookname", "") sle_sqldb_mdf_sor.Text = ProfileString (sys_inifilename, "database", "sqldb_mdf_sor", '') sle_sqldb_ldf_sor.Text = ProfileString (sys_inifilename, "database", "sqldb_ldf_sor",'' ) String ls_fjname, ls_yjname ls_fjname = ProfileString (sys_inifilename, "database", "defaultfjdb",'' ) ls_yjname = ProfileString (sys_inifilename, "database", "defaultyjdb",'' ) IF ls_fjname = "" THEN ls_fjname = "企精灵附件数据库" END IF IF ls_yjname = "" THEN ls_yjname = "企精灵邮件数据库" END IF sle_fjname.Text = sys_cur_path + ls_fjname +'.dat' sle_yjname.Text = sys_cur_path + ls_yjname +'.dat' Long i String ls_temp FOR i = 1 To 3 ls_temp = ProfileString (sys_inifilename, "database", "demodb" + String(i), '') IF ls_temp <> '' THEN ddlb_1.AddItem (ls_temp) END IF IF i = 1 THEN ddlb_1.Text = ls_temp sle_filename.Text = sys_cur_path + ddlb_1.Text + '.dat' END IF NEXT wf_findisql() masterpath = sys_cur_path + 'database' sle_folder.Text = masterpath IF sle_server.Text = "" THEN sle_server.Text = "." // cb_1.Text = '︽' //ELSE // This.Height = 780 // gb_1.Visible = False // st_7.Visible = False // sle_server.Visible = False // st_5.Visible = False // sle_logid.Visible = False // st_6.Visible = False // sle_logpass.Visible = False END IF IF sle_database.Text = "" THEN sle_database.Text = "EW5_DB" END IF IF sle_logid.Text = "" THEN sle_logid.Text = "sa" END IF cb_1.Text = '︾' wf_facechange() end event on w_set_sqlca_ecl.create int iCurrent call super::create this.cb_ok=create cb_ok this.sle_logpass=create sle_logpass this.sle_logid=create sle_logid this.sle_server=create sle_server this.sle_database=create sle_database this.sle_dbpass=create sle_dbpass this.sle_userid=create sle_userid this.sle_dbparm=create sle_dbparm this.st_9=create st_9 this.st_6=create st_6 this.st_5=create st_5 this.st_4=create st_4 this.st_3=create st_3 this.st_2=create st_2 this.st_00=create st_00 this.st_7=create st_7 this.sle_dbms=create sle_dbms this.st_2334=create st_2334 this.st_345=create st_345 this.sle_sqldb_mdf_sor=create sle_sqldb_mdf_sor this.sle_sqldb_ldf_sor=create sle_sqldb_ldf_sor this.st_jd=create st_jd this.st_1=create st_1 this.sle_bookname=create sle_bookname this.sle_fjname=create sle_fjname this.cb_ch3=create cb_ch3 this.cb_1=create cb_1 this.st_11=create st_11 this.ddlb_1=create ddlb_1 this.st_12=create st_12 this.rb_1=create rb_1 this.rb_2=create rb_2 this.sle_filename=create sle_filename this.cb_ch2=create cb_ch2 this.st_13=create st_13 this.sle_folder=create sle_folder this.cb_2=create cb_2 this.cbx_modify=create cbx_modify this.st_8=create st_8 this.cbx_fj=create cbx_fj this.st_10=create st_10 this.cbx_yj=create cbx_yj this.sle_yjname=create sle_yjname this.cb_ch4=create cb_ch4 this.cb_connect=create cb_connect this.gb_1=create gb_1 this.gb_2=create gb_2 this.gb_3=create gb_3 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_ok this.Control[iCurrent+2]=this.sle_logpass this.Control[iCurrent+3]=this.sle_logid this.Control[iCurrent+4]=this.sle_server this.Control[iCurrent+5]=this.sle_database this.Control[iCurrent+6]=this.sle_dbpass this.Control[iCurrent+7]=this.sle_userid this.Control[iCurrent+8]=this.sle_dbparm this.Control[iCurrent+9]=this.st_9 this.Control[iCurrent+10]=this.st_6 this.Control[iCurrent+11]=this.st_5 this.Control[iCurrent+12]=this.st_4 this.Control[iCurrent+13]=this.st_3 this.Control[iCurrent+14]=this.st_2 this.Control[iCurrent+15]=this.st_00 this.Control[iCurrent+16]=this.st_7 this.Control[iCurrent+17]=this.sle_dbms this.Control[iCurrent+18]=this.st_2334 this.Control[iCurrent+19]=this.st_345 this.Control[iCurrent+20]=this.sle_sqldb_mdf_sor this.Control[iCurrent+21]=this.sle_sqldb_ldf_sor this.Control[iCurrent+22]=this.st_jd this.Control[iCurrent+23]=this.st_1 this.Control[iCurrent+24]=this.sle_bookname this.Control[iCurrent+25]=this.sle_fjname this.Control[iCurrent+26]=this.cb_ch3 this.Control[iCurrent+27]=this.cb_1 this.Control[iCurrent+28]=this.st_11 this.Control[iCurrent+29]=this.ddlb_1 this.Control[iCurrent+30]=this.st_12 this.Control[iCurrent+31]=this.rb_1 this.Control[iCurrent+32]=this.rb_2 this.Control[iCurrent+33]=this.sle_filename this.Control[iCurrent+34]=this.cb_ch2 this.Control[iCurrent+35]=this.st_13 this.Control[iCurrent+36]=this.sle_folder this.Control[iCurrent+37]=this.cb_2 this.Control[iCurrent+38]=this.cbx_modify this.Control[iCurrent+39]=this.st_8 this.Control[iCurrent+40]=this.cbx_fj this.Control[iCurrent+41]=this.st_10 this.Control[iCurrent+42]=this.cbx_yj this.Control[iCurrent+43]=this.sle_yjname this.Control[iCurrent+44]=this.cb_ch4 this.Control[iCurrent+45]=this.cb_connect this.Control[iCurrent+46]=this.gb_1 this.Control[iCurrent+47]=this.gb_2 this.Control[iCurrent+48]=this.gb_3 end on on w_set_sqlca_ecl.destroy call super::destroy destroy(this.cb_ok) destroy(this.sle_logpass) destroy(this.sle_logid) destroy(this.sle_server) destroy(this.sle_database) destroy(this.sle_dbpass) destroy(this.sle_userid) destroy(this.sle_dbparm) destroy(this.st_9) destroy(this.st_6) destroy(this.st_5) destroy(this.st_4) destroy(this.st_3) destroy(this.st_2) destroy(this.st_00) destroy(this.st_7) destroy(this.sle_dbms) destroy(this.st_2334) destroy(this.st_345) destroy(this.sle_sqldb_mdf_sor) destroy(this.sle_sqldb_ldf_sor) destroy(this.st_jd) destroy(this.st_1) destroy(this.sle_bookname) destroy(this.sle_fjname) destroy(this.cb_ch3) destroy(this.cb_1) destroy(this.st_11) destroy(this.ddlb_1) destroy(this.st_12) destroy(this.rb_1) destroy(this.rb_2) destroy(this.sle_filename) destroy(this.cb_ch2) destroy(this.st_13) destroy(this.sle_folder) destroy(this.cb_2) destroy(this.cbx_modify) destroy(this.st_8) destroy(this.cbx_fj) destroy(this.st_10) destroy(this.cbx_yj) destroy(this.sle_yjname) destroy(this.cb_ch4) destroy(this.cb_connect) destroy(this.gb_1) destroy(this.gb_2) destroy(this.gb_3) end on event close;call super::close;IF IsValid(w_sys_login_s) THEN w_sys_login_s.Dynamic wf_getbook(True) END IF end event type cb_func from w_publ_base`cb_func within w_set_sqlca_ecl boolean visible = false integer x = 1934 integer y = 644 integer taborder = 70 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_set_sqlca_ecl integer x = 1513 integer y = 532 integer width = 315 integer taborder = 110 string text = "取消" end type type cb_ok from uo_imflatbutton within w_set_sqlca_ecl integer x = 965 integer y = 532 integer width = 315 integer height = 96 integer taborder = 90 end type event clicked;call super::clicked;IF Trim(sle_bookname.Text) = '' THEN MessageBox('系统提示','请输入帐套!',information!,OK!) RETURN END IF IF Trim(sle_database.Text) = '' THEN MessageBox('系统提示','请输入数据库!',information!,OK!) RETURN END IF IF Trim(sle_server.Text) = '' THEN MessageBox('系统提示','请输入服务器!',information!,OK!) RETURN END IF IF rb_1.Checked THEN String ls_msg Int ll_rslt ll_rslt = wf_buildsqldb(ls_msg) //1-成功 IF ll_rslt = 0 THEN //错误 MessageBox("提示",ls_msg,information!,OK!) RETURN ELSEIF ll_rslt = 2 THEN //取消 RETURN END IF END IF SetProfileString (sys_inifilename, 'database', 'dbms', sle_dbms.Text) SetProfileString (sys_inifilename, "database", "bookname", sle_bookname.Text ) SetProfileString (sys_inifilename, "database", "database", sle_database.Text) SetProfileString (sys_inifilename, "database", "userid", sle_userid.Text) SetProfileString (sys_inifilename, "database", "dbpass", f_psw_bczh(sle_dbpass.Text,0,sys_power_key)) 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) SetProfileString (sys_inifilename, "database", "dbparm", f_psw_bczh(sle_dbparm.Text,0,sys_power_key)) SetProfileString (sys_inifilename, "database", "sqldb_mdf_sor", sle_sqldb_mdf_sor.Text) SetProfileString (sys_inifilename, "database", "sqldb_ldf_sor", sle_sqldb_ldf_sor.Text) //增加一个帐套 String ls_ini_book Long id String ifuse IF IsNumber(is_bookcode) THEN id = Integer(is_bookcode) ELSE id = 1 END IF String ls_temp ls_temp = Trim(sle_bookname.Text) + ':'+& Trim(sle_database.Text)+ ':'+& is_bookcode+':'+& '1' //SetProfileString (sys_inifilename_other,'sys_dl_book', '1', f_psw_bczh(ls_temp,0,sys_power_key)) SetProfileString (sys_inifilename_other,'sys_dl_book', String(id), ls_temp) SetProfileString(sys_inifilename,'longjoews','LastAcount',Trim(sle_bookname.Text)) SetProfileString (sys_inifilename, "database", "firstrun","0") MessageBox('提示','设置保存完成!系统必须重启!') Restart() end event type sle_logpass from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 804 integer width = 1655 integer height = 80 integer taborder = 140 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 sle_logid from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 708 integer width = 1655 integer height = 80 integer taborder = 130 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 sle_server from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 608 integer width = 1655 integer height = 80 integer taborder = 120 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 sle_database from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 276 integer width = 1655 integer height = 80 integer taborder = 20 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 sle_dbpass from singlelineedit within w_set_sqlca_ecl integer x = 2414 integer y = 288 integer width = 270 integer height = 80 integer taborder = 100 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 boolean enabled = false boolean autohscroll = false boolean password = true borderstyle borderstyle = stylelowered! end type type sle_userid from singlelineedit within w_set_sqlca_ecl boolean visible = false integer x = 2418 integer y = 372 integer width = 219 integer height = 80 integer taborder = 40 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 boolean enabled = false boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type sle_dbparm from singlelineedit within w_set_sqlca_ecl boolean visible = false integer x = 384 integer y = 508 integer width = 306 integer height = 80 integer taborder = 250 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 borderstyle borderstyle = stylelowered! end type type st_9 from statictext within w_set_sqlca_ecl boolean visible = false integer x = 192 integer y = 656 integer width = 233 integer height = 60 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 long backcolor = 74481808 boolean enabled = false string text = "DBPARM:" alignment alignment = right! boolean focusrectangle = false end type type st_6 from statictext within w_set_sqlca_ecl integer x = 146 integer y = 812 integer width = 256 integer height = 60 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 st_5 from statictext within w_set_sqlca_ecl integer x = 146 integer y = 720 integer width = 256 integer height = 60 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 st_4 from statictext within w_set_sqlca_ecl boolean visible = false integer x = 151 integer y = 216 integer width = 274 integer height = 60 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 long backcolor = 134217739 boolean enabled = false string text = "口令:" alignment alignment = right! boolean focusrectangle = false end type type st_3 from statictext within w_set_sqlca_ecl boolean visible = false integer x = 187 integer y = 128 integer width = 238 integer height = 60 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 long backcolor = 134217739 boolean enabled = false string text = "用户ID:" alignment alignment = right! boolean focusrectangle = false end type type st_2 from statictext within w_set_sqlca_ecl integer x = 105 integer y = 288 integer width = 297 integer height = 60 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 st_00 from statictext within w_set_sqlca_ecl boolean visible = false integer x = 82 integer y = 40 integer width = 343 integer height = 60 integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long backcolor = 134217739 boolean enabled = false string text = "DBMS:" alignment alignment = right! boolean focusrectangle = false end type type st_7 from statictext within w_set_sqlca_ecl integer x = 146 integer y = 620 integer width = 256 integer height = 60 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_dbms from dropdownlistbox within w_set_sqlca_ecl boolean visible = false integer x = 443 integer y = 28 integer width = 1422 integer height = 156 integer taborder = 280 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 33554432 boolean allowedit = true boolean sorted = false boolean vscrollbar = true string item[] = {"ODBC","MSS Microsoft SQL Server 6.x"} borderstyle borderstyle = stylelowered! end type event selectionchanged;wf_findisql() end event event modified;sle_dbms.postevent(selectionchanged!) end event type st_2334 from statictext within w_set_sqlca_ecl boolean visible = false integer x = 128 integer y = 1140 integer width = 329 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 boolean enabled = false string text = "源数据名称:" alignment alignment = right! boolean focusrectangle = false end type type st_345 from statictext within w_set_sqlca_ecl boolean visible = false integer x = 128 integer y = 1232 integer width = 329 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 boolean enabled = false string text = "源日志名称:" alignment alignment = right! boolean focusrectangle = false end type type sle_sqldb_mdf_sor from singlelineedit within w_set_sqlca_ecl boolean visible = false integer x = 457 integer y = 1124 integer width = 1655 integer height = 80 integer taborder = 180 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type sle_sqldb_ldf_sor from singlelineedit within w_set_sqlca_ecl boolean visible = false integer x = 457 integer y = 1216 integer width = 1655 integer height = 80 integer taborder = 220 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type st_jd from statictext within w_set_sqlca_ecl integer x = 1486 integer y = 40 integer width = 768 integer height = 84 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 16711680 long backcolor = 16777215 boolean enabled = false boolean focusrectangle = false end type type st_1 from statictext within w_set_sqlca_ecl integer x = 146 integer y = 172 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_bookname from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 160 integer width = 1655 integer height = 80 integer taborder = 10 boolean bringtotop = true integer textsize = -8 integer weight = 400 fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "MS Sans Serif" long textcolor = 41943040 string text = "演示帐套" boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type sle_fjname from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 1100 integer width = 1655 integer height = 80 integer taborder = 160 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_ch3 from commandbutton within w_set_sqlca_ecl integer x = 2075 integer y = 1092 integer width = 114 integer height = 84 integer taborder = 210 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "..." end type event clicked; Integer i String Pathname,Filename i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat") IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN sle_fjname.Text = Pathname END IF end event type cb_1 from commandbutton within w_set_sqlca_ecl integer x = 1915 integer y = 392 integer width = 82 integer height = 84 integer taborder = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "︾" end type event clicked;IF cb_1.Text = '︽' THEN cb_1.Text = '︾' ELSE cb_1.Text = '︽' END IF wf_facechange() //IF THIS.Text <> '︽' THEN // PARENT.Height = 1700 //PARENT.Height + 1000 // THIS.Text = '︽' // // gb_1.visible = true // st_7.visible = true // sle_server.visible = true // st_5.visible = true // sle_logid.visible = true // st_6.visible = true // sle_logpass.visible = true // // cb_ok.y = 1436 // cb_exit.y = 1436 //ELSE // PARENT.Height = 780 //PARENT.Height - 1000 // THIS.Text = '︾' // // gb_1.visible = false // st_7.visible = false // sle_server.visible = false // st_5.visible = false // sle_logid.visible = false // st_6.visible = false // sle_logpass.visible = false // // cb_ok.y = 532 // cb_exit.y = 532 // //END IF end event type st_11 from statictext within w_set_sqlca_ecl integer x = 2007 integer y = 412 integer width = 233 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "高级选项" boolean focusrectangle = false end type type ddlb_1 from dropdownlistbox within w_set_sqlca_ecl integer x = 416 integer y = 400 integer width = 1166 integer height = 300 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type event selectionchanged;sle_filename.text = sys_cur_path + this.text + '.dat' end event type st_12 from statictext within w_set_sqlca_ecl integer x = 105 integer y = 408 integer width = 297 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 rb_1 from radiobutton within w_set_sqlca_ecl integer x = 453 integer y = 40 integer width = 402 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 boolean enabled = false string text = "新建数据库" end type event clicked;wf_facechange() end event type rb_2 from radiobutton within w_set_sqlca_ecl integer x = 882 integer y = 40 integer width = 466 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "连接现有数据库" boolean checked = true end type event clicked;cb_1.Text = '︾' wf_facechange() // ddlb_1.Enabled = False // cbx_modify.Enabled = False // sle_filename.Enabled = False // cb_ch2.Enabled = False // sle_fjname.Enabled = False // cb_ch3.Enabled = False // sle_folder.Enabled = False // cb_2.Enabled = False // cbx_fj.Enabled = False // st_1.Enabled = False // st_12.Enabled = False // st_8.Enabled = False // st_13.Enabled = False // cbx_yj.Enabled = False // sle_yjname.Enabled = False // cb_ch4.Enabled = False // // This.Height = 780 // cb_1.Text = '︾' // // gb_1.Visible = False // st_7.Visible = False // sle_server.Visible = False // st_5.Visible = False // sle_logid.Visible = False // st_6.Visible = False // sle_logpass.Visible = False // // cb_ok.Y = 532 // cb_exit.Y = 532 end event type sle_filename from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 996 integer width = 1655 integer height = 80 integer taborder = 150 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean enabled = false borderstyle borderstyle = stylelowered! end type type cb_ch2 from commandbutton within w_set_sqlca_ecl integer x = 2075 integer y = 992 integer width = 114 integer height = 84 integer taborder = 200 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" boolean enabled = false string text = "..." end type event clicked; Integer i String Pathname,Filename i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat") IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN sle_filename.Text = Pathname END IF end event type st_13 from statictext within w_set_sqlca_ecl integer x = 46 integer y = 1332 integer width = 370 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 boolean enabled = false string text = "目标文件路径:" alignment alignment = right! boolean focusrectangle = false end type type sle_folder from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 1316 integer width = 1655 integer height = 80 integer taborder = 190 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_2 from commandbutton within w_set_sqlca_ecl integer x = 2075 integer y = 1312 integer width = 114 integer height = 84 integer taborder = 240 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "..." end type event clicked; // //GetFolder() //功 能:显示文件夹选择对话框。 //语 法:GetFolder (title , director ) //参 数:title:String类型,指定文件夹选择框的标题; // directory:String类型,文件夹的路径,即指定显示哪个文件夹下的子文件夹,又用于保存用户最终选择的文件夹的路径。 //返回值:Integer。函数执行成功时返回1,发生错误时返回-1。当用户选择了”取消”按钮或直接关闭对话框,函数返回0。 //示 例:This example displays the folder contents of the Sybase directory in a folder selection dialog box. The string passed in the title argument displays above the tree view: string ls_path integer li_result ls_path = mid(sys_cur_path,1,len(sys_cur_path )- 1) li_result = GetFolder( "目标文件路径", ls_path ) sle_folder.text=ls_path end event type cbx_modify from checkbox within w_set_sqlca_ecl integer x = 1595 integer y = 408 integer width = 311 integer height = 60 integer taborder = 50 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "手动修改" end type event clicked;IF THIS.Checked THEN ddlb_1.Enabled = FALSE cb_ch2.Enabled = TRUE sle_filename.Enabled = TRUE sle_filename.text = '' ELSE ddlb_1.Enabled = TRUE cb_ch2.Enabled = FALSE sle_filename.Enabled = FALSE sle_filename.text = sys_cur_path + ddlb_1.text + '.dat' END IF end event type st_8 from statictext within w_set_sqlca_ecl integer x = 46 integer y = 1008 integer width = 370 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 boolean enabled = false string text = "主数据库:" alignment alignment = right! boolean focusrectangle = false end type type cbx_fj from checkbox within w_set_sqlca_ecl integer x = 41 integer y = 1112 integer width = 375 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "附件数据库:" boolean checked = true end type event clicked;if rb_2.checked then return IF cbx_fj.Checked THEN sle_fjname.Enabled = TRUE cb_ch3.Enabled = TRUE ELSE sle_fjname.Enabled = FALSE cb_ch3.Enabled = FALSE END IF end event type st_10 from statictext within w_set_sqlca_ecl integer x = 82 integer y = 44 integer width = 325 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 cbx_yj from checkbox within w_set_sqlca_ecl integer x = 41 integer y = 1220 integer width = 384 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 string text = "邮件数据库:" boolean checked = true end type event clicked;IF rb_2.Checked THEN RETURN IF cbx_yj.Checked THEN sle_yjname.Enabled = TRUE cb_ch4.Enabled = TRUE ELSE sle_yjname.Enabled = FALSE cb_ch4.Enabled = FALSE END IF end event type sle_yjname from singlelineedit within w_set_sqlca_ecl integer x = 416 integer y = 1208 integer width = 1655 integer height = 80 integer taborder = 170 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_ch4 from commandbutton within w_set_sqlca_ecl integer x = 2075 integer y = 1200 integer width = 114 integer height = 84 integer taborder = 230 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "..." end type event clicked; Integer i String Pathname,Filename i = GetFileSaveName("选择备份文件",Pathname,Filename,"Dat","数据文件Dat,*.Dat") IF i = 1 AND Trim(Pathname) <> '' AND Trim(Filename) <> "" THEN sle_yjname.Text = Pathname END IF end event type cb_connect from uo_imflatbutton within w_set_sqlca_ecl integer x = 416 integer y = 524 integer width = 315 integer height = 96 integer taborder = 80 boolean bringtotop = true string text = "测试连接" end type event clicked;call super::clicked;IF Trim(sle_bookname.Text) = '' THEN MessageBox('系统提示','请输入帐套!',information!,OK!) RETURN END IF IF Trim(sle_database.Text) = '' THEN MessageBox('系统提示','请输入数据库!',information!,OK!) RETURN END IF 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 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 = sle_database.Text 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= '" + sle_database.Text + "',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 + "用户密码错误!" cb_1.Text = '︽' wf_facechange() sle_logpass.SetFocus() END IF IF rb_1.Checked And Pos(db_Transaction.SQLErrText, "'"+sle_database.Text+"'") > 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_sqlca_ecl integer x = 18 integer y = 540 integer width = 2217 integer height = 392 integer taborder = 260 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 end type type gb_2 from groupbox within w_set_sqlca_ecl integer x = 18 integer y = 936 integer width = 2217 integer height = 484 integer taborder = 270 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 end type type gb_3 from groupbox within w_set_sqlca_ecl integer x = 411 integer width = 1051 integer height = 120 integer taborder = 290 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 16711680 long backcolor = 16777215 end type