$PBExportHeader$w_set_sqlca.srw
$PBExportComments$数据库连接窗口
forward
global type w_set_sqlca from w_publ_base
end type
type cb_ok from uo_imflatbutton within w_set_sqlca
end type
type sle_logpass from singlelineedit within w_set_sqlca
end type
type sle_logid from singlelineedit within w_set_sqlca
end type
type sle_server from singlelineedit within w_set_sqlca
end type
type sle_database from singlelineedit within w_set_sqlca
end type
type sle_dbpass from singlelineedit within w_set_sqlca
end type
type sle_userid from singlelineedit within w_set_sqlca
end type
type sle_dbparm from singlelineedit within w_set_sqlca
end type
type st_9 from statictext within w_set_sqlca
end type
type st_6 from statictext within w_set_sqlca
end type
type st_5 from statictext within w_set_sqlca
end type
type st_4 from statictext within w_set_sqlca
end type
type st_3 from statictext within w_set_sqlca
end type
type st_2 from statictext within w_set_sqlca
end type
type st_00 from statictext within w_set_sqlca
end type
type st_7 from statictext within w_set_sqlca
end type
type cb_ch2 from commandbutton within w_set_sqlca
end type
type sle_filename from singlelineedit within w_set_sqlca
end type
type cbx_addnewdatabase from checkbox within w_set_sqlca
end type
type rb_server from radiobutton within w_set_sqlca
end type
type rb_2 from radiobutton within w_set_sqlca
end type
type sle_dbms from dropdownlistbox within w_set_sqlca
end type
type st_8 from statictext within w_set_sqlca
end type
type sle_sqldb_mdf from singlelineedit within w_set_sqlca
end type
type sle_sqldb_ldf from singlelineedit within w_set_sqlca
end type
type st_91 from statictext within w_set_sqlca
end type
type st_912 from statictext within w_set_sqlca
end type
type cb_sqldb_mdf from commandbutton within w_set_sqlca
end type
type cb_sqldb_ldf from commandbutton within w_set_sqlca
end type
type gb_1 from groupbox within w_set_sqlca
end type
type st_193 from statictext within w_set_sqlca
end type
type st_2334 from statictext within w_set_sqlca
end type
type st_345 from statictext within w_set_sqlca
end type
type sle_sqldb_mdf_sor from singlelineedit within w_set_sqlca
end type
type sle_sqldb_ldf_sor from singlelineedit within w_set_sqlca
end type
type cbx_db_h from checkbox within w_set_sqlca
end type
type gb_3 from groupbox within w_set_sqlca
end type
type st_jd from statictext within w_set_sqlca
end type
end forward

global type w_set_sqlca from w_publ_base
integer x = 283
integer y = 12
integer width = 2331
integer height = 1396
string title = "数据库连接设置"
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
cb_ch2 cb_ch2
sle_filename sle_filename
cbx_addnewdatabase cbx_addnewdatabase
rb_server rb_server
rb_2 rb_2
sle_dbms sle_dbms
st_8 st_8
sle_sqldb_mdf sle_sqldb_mdf
sle_sqldb_ldf sle_sqldb_ldf
st_91 st_91
st_912 st_912
cb_sqldb_mdf cb_sqldb_mdf
cb_sqldb_ldf cb_sqldb_ldf
gb_1 gb_1
st_193 st_193
st_2334 st_2334
st_345 st_345
sle_sqldb_mdf_sor sle_sqldb_mdf_sor
sle_sqldb_ldf_sor sle_sqldb_ldf_sor
cbx_db_h cbx_db_h
gb_3 gb_3
st_jd st_jd
end type
global w_set_sqlca w_set_sqlca

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" 
end prototypes

type variables
INT ARROWADDNEW
string ls_bat_filename='_ls_cmd_run.bat'
string ls_txt_filename='_ls_cmd_rslt.txt'
string masterpath
end variables

forward prototypes
public function integer wf_autobuiltmdflogname ()
public function integer wf_buildsqldb ()
public function integer wf_findisql ()
end prototypes

public function integer wf_autobuiltmdflogname ();//wf_autobuiltmdflogname

sle_sqldb_ldf.text=masterpath+sle_database.text+'_log.ldf'
sle_sqldb_mdf.text=masterpath+sle_database.text+'_data.MDF'
return 1
end function

public function integer wf_buildsqldb ();//wf_buildsqldb

integer li_FileNum,rslt=1
string comm,msg
long i,j,lu_return

comm=' create DATABASE '+sle_database.Text+&
" on(name='"+sle_sqldb_mdf_sor.text+"',FILENAME= '"+sle_sqldb_mdf.text+"') log on (name='"+sle_sqldb_ldf_sor.text+"',FILENAME= '"+sle_sqldb_ldf.text+"')"


//sqlca.DBMS       = ProfileString (sys_inifilename, "database", "dbms",       "")
sqlca.database   = 'master'
//sqlca.userid     = ProfileString (sys_inifilename, "database", "userid",     "")
//sqlca.dbpass     = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbpass",     ""),1,sys_power_key)
sqlca.logid      = sle_logid.Text
sqlca.logpass    = sle_logpass.Text 
sqlca.servername =  sle_server.Text 
//sqlca.dbparm     = f_psw_bczh(ProfileString (sys_inifilename, "database", "dbparm",     ""),1,sys_power_key)

if sqlca.database='' or sqlca.servername='' then
	Messagebox("系统提示","连接数据管理库失败!")
	return 0
end if

connect using sqlca;
sqlca.autocommit=true
st_jd.text='正在新建数据库...'
Execute immediate :comm using sqlca;  
if sqlca.sqlcode<>0 then
	msg='建立失败,请手动建立及恢复数据库>'+sqlca.sqlerrtext
	rollback;
	messagebox('系统提示',msg)
	rslt=0
	goto ext
else
	rslt=1
	commit;
end if


st_jd.text='正在恢复数据库...'

comm= 'RESTORE DATABASE '+sle_database.Text+" from DISK= '"+sle_filename.text+"'"+&
	" WITH MOVE '"+sle_sqldb_mdf_sor.text+"' TO '"+sle_sqldb_mdf.text+"',"+&
	" MOVE '"+sle_sqldb_ldf_sor.text+"' TO '"+sle_sqldb_ldf.text+"',"+'REPLACE'
	
Execute immediate :comm using sqlca; 
if sqlca.sqlcode<>0 then
	msg='恢复失败,请手动恢复数据库>'+sqlca.sqlerrtext
	rollback;
	messagebox('系统提示',msg)
	rslt=0
else
	rslt=1
	commit;
end if

ext:

return rslt
end function

public function integer wf_findisql ();//wf_findisql


	IF FILEEXISTs('c:\mssql7\data\master.mdf') then
		masterpath='c:\mssql7\data\'
		goto ext
	end if
	IF FILEEXISTs('c:\Program Files\Microsoft SQL Server\80\data\master.mdf') then
		masterpath='c:\Program Files\Microsoft SQL Server\data\'
		goto ext
	end if

	IF fileexists('c:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') then
		masterpath="c:\Program Files\Microsoft SQL Server\MSSQL\data\"
		goto ext
	end if	
	
	IF FILEEXISTs('d:\mssql7\data\master.mdf') then
		masterpath='d:\mssql7\data\'
		goto ext
	end if
	IF FILEEXISTs('d:\Program Files\Microsoft SQL Server\80\data\master.mdf') then
		masterpath='d:\Program Files\Microsoft SQL Server\data\'
		goto ext
	end if

	IF FILEEXISTs('d:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') then
		masterpath='d:\Program Files\Microsoft SQL Server\MSSQL\data\'
		goto ext
	end if	
	
	IF FILEEXISTs('e:\mssql7\data\master.mdf') then
		masterpath='e:\mssql7\data\'
		goto ext
	end if
	IF FILEEXISTs('e:\Program Files\Microsoft SQL Server\80\data\master.mdf') then
		masterpath='e:\Program Files\Microsoft SQL Server\data\'
		goto ext
	end if

	IF FILEEXISTs('e:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') then
		masterpath='e:\Program Files\Microsoft SQL Server\MSSQL\data\'
		goto ext
	end if	

	IF FILEEXISTs('f:\mssql7\data\master.mdf') then
		masterpath='f:\mssql7\data\'
		goto ext
	end if
	IF FILEEXISTs('f:\Program Files\Microsoft SQL Server\80\data\master.mdf') then
		masterpath='f:\Program Files\Microsoft SQL Server\data\'
		goto ext
	end if

	IF FILEEXISTs('f:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') then
		masterpath='f:\Program Files\Microsoft SQL Server\MSSQL\data\'
		goto ext
	end if	

	IF FILEEXISTs('g:\mssql7\data\master.mdf') then
		masterpath='g:\mssql7\data\'
		goto ext
	end if
	IF FILEEXISTs('g:\Program Files\Microsoft SQL Server\80\data\master.mdf') then
		masterpath='g:\Program Files\Microsoft SQL Server\data\'
		goto ext
	end if

	IF FILEEXISTs('g:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') then
		masterpath='g:\Program Files\Microsoft SQL Server\MSSQL\data\'
		goto ext
	end if	

	IF FILEEXISTs('h:\mssql7\data\master.mdf') then
		masterpath='h:\mssql7\data\'
		goto ext
	end if
	IF FILEEXISTs('h:\Program Files\Microsoft SQL Server\80\data\master.mdf') then
		masterpath='h:\Program Files\Microsoft SQL Server\data\'
		goto ext
	end if

	IF FILEEXISTs('h:\Program Files\Microsoft SQL Server\MSSQL\data\master.mdf') then
		masterpath='h:\Program Files\Microsoft SQL Server\MSSQL\data\'
		goto ext
	end if	
	
ext:
if masterpath='' then masterpath="c:\Program Files\Microsoft SQL Server\MSSQL\data\"
wf_autobuiltmdflogname()

return  0


end function

event open;call super::open;// Open script for W_SET_SQLCA
 ARROWADDNEW=Message.DoubleParm
IF ARROWADDNEW= 0 THEN 
	cbx_addnewdatabase.ENABLED=FALSE
END IF

sle_dbms.Text = sqlca.DBMS
sle_database.Text = sqlca.database
sle_userid.Text	= sqlca.userid
sle_dbpass.Text	= sqlca.dbpass
sle_logid.Text		= sqlca.logid
sle_logpass.Text	= sqlca.logpass
sle_server.Text	= sqlca.servername	
sle_dbparm.Text	= sqlca.dbparm


sle_sqldb_mdf_sor.Text=ProfileString (sys_inifilename, "database", "sqldb_mdf_sor", '')
sle_sqldb_ldf_sor.Text=ProfileString (sys_inifilename, "database", "sqldb_ldf_sor",'' )

//messagebox('',ProfileString(sys_inifilename,'SERVER','SERVER',''))
if trim(ProfileString(sys_inifilename,'SERVER','SERVER',''))='' then
	rb_2.checked=true
else
	rb_server.checked=true
end if
rb_server.postevent(clicked!)
cbx_addnewdatabase.triggerevent(clicked!)
wf_findisql()


end event

on w_set_sqlca.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.cb_ch2=create cb_ch2
this.sle_filename=create sle_filename
this.cbx_addnewdatabase=create cbx_addnewdatabase
this.rb_server=create rb_server
this.rb_2=create rb_2
this.sle_dbms=create sle_dbms
this.st_8=create st_8
this.sle_sqldb_mdf=create sle_sqldb_mdf
this.sle_sqldb_ldf=create sle_sqldb_ldf
this.st_91=create st_91
this.st_912=create st_912
this.cb_sqldb_mdf=create cb_sqldb_mdf
this.cb_sqldb_ldf=create cb_sqldb_ldf
this.gb_1=create gb_1
this.st_193=create st_193
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.cbx_db_h=create cbx_db_h
this.gb_3=create gb_3
this.st_jd=create st_jd
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.cb_ch2
this.Control[iCurrent+18]=this.sle_filename
this.Control[iCurrent+19]=this.cbx_addnewdatabase
this.Control[iCurrent+20]=this.rb_server
this.Control[iCurrent+21]=this.rb_2
this.Control[iCurrent+22]=this.sle_dbms
this.Control[iCurrent+23]=this.st_8
this.Control[iCurrent+24]=this.sle_sqldb_mdf
this.Control[iCurrent+25]=this.sle_sqldb_ldf
this.Control[iCurrent+26]=this.st_91
this.Control[iCurrent+27]=this.st_912
this.Control[iCurrent+28]=this.cb_sqldb_mdf
this.Control[iCurrent+29]=this.cb_sqldb_ldf
this.Control[iCurrent+30]=this.gb_1
this.Control[iCurrent+31]=this.st_193
this.Control[iCurrent+32]=this.st_2334
this.Control[iCurrent+33]=this.st_345
this.Control[iCurrent+34]=this.sle_sqldb_mdf_sor
this.Control[iCurrent+35]=this.sle_sqldb_ldf_sor
this.Control[iCurrent+36]=this.cbx_db_h
this.Control[iCurrent+37]=this.gb_3
this.Control[iCurrent+38]=this.st_jd
end on

on w_set_sqlca.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.cb_ch2)
destroy(this.sle_filename)
destroy(this.cbx_addnewdatabase)
destroy(this.rb_server)
destroy(this.rb_2)
destroy(this.sle_dbms)
destroy(this.st_8)
destroy(this.sle_sqldb_mdf)
destroy(this.sle_sqldb_ldf)
destroy(this.st_91)
destroy(this.st_912)
destroy(this.cb_sqldb_mdf)
destroy(this.cb_sqldb_ldf)
destroy(this.gb_1)
destroy(this.st_193)
destroy(this.st_2334)
destroy(this.st_345)
destroy(this.sle_sqldb_mdf_sor)
destroy(this.sle_sqldb_ldf_sor)
destroy(this.cbx_db_h)
destroy(this.gb_3)
destroy(this.st_jd)
end on

type cb_func from w_publ_base`cb_func within w_set_sqlca
boolean visible = false
integer x = 1934
integer y = 644
boolean enabled = false
end type

type cb_exit from w_publ_base`cb_exit within w_set_sqlca
integer x = 1938
integer y = 168
integer width = 315
string text = "取消"
end type

type cb_ok from uo_imflatbutton within w_set_sqlca
integer x = 1938
integer y = 48
integer width = 315
integer height = 96
integer taborder = 60
end type

event clicked;call super::clicked;IF rb_server.Checked THEN
	SetProfileString(sys_inifilename,'SERVER','SERVER','服务器模式')
ELSE
	SetProfileString(sys_inifilename,'SERVER','SERVER',' ')
END IF


String ls_str
ls_str = ProfileString(sys_inifilename,'SERVER','SERVER','')


IF cbx_addnewdatabase.Checked THEN
	
	IF NOT FileExists(sle_filename.Text) THEN
		MessageBox("操作错误","指定恢复数据文件不存在",stopsign!)
		RETURN
	END IF
	//	if messagebox("警告!","如果数据库已经存在,此操作可能将使当前数据库被覆盖,是否进行操作？",exclamation!,OKCancel!,2)=2 then
	//		RETURN
	//	end if
	IF Trim(sle_sqldb_mdf.Text) = '' OR Trim(sle_sqldb_ldf.Text) = '' THEN
		wf_autobuiltmdflogname()
	ELSE
		IF Pos(sle_sqldb_mdf.Text,':') = 0 OR Lower(Right(sle_sqldb_mdf.Text,4)) <> '.mdf' THEN
			MessageBox('','目标数据库文件名称错误!')
			RETURN
		END IF
		IF Pos(sle_sqldb_ldf.Text,':') = 0 OR Lower(Right(sle_sqldb_ldf.Text,4)) <> '.ldf' THEN
			MessageBox('','目标日志文件名称错误!')
			RETURN
		END IF
	END IF
END IF

IF Trim(sle_database.Text) = '' THEN
	MessageBox('系统提示','请输入database!')
	RETURN
END IF

IF Trim(sle_server.Text) = '' THEN
	MessageBox('系统提示','请输入server name!')
	RETURN
END IF


SetProfileString (sys_inifilename, "database", "dbms",       sle_dbms.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))

IF cbx_addnewdatabase.Checked THEN
	IF cbx_db_h.Checked THEN
		SetProfileString (sys_inifilename, "database", "sqldb_mdf_sor", sle_sqldb_mdf_sor.Text)
		SetProfileString (sys_inifilename, "database", "sqldb_ldf_sor", sle_sqldb_ldf_sor.Text)
	END IF
	
	IF wf_buildsqldb() = 0 THEN
		MessageBox("系统提示","生成数据库操作失败!")
		RETURN
	END IF
	
END IF
MessageBox('','设置保存完成!系统必须重起!')
CloseWithReturn (PARENT,1)

Restart()


end event

type sle_logpass from singlelineedit within w_set_sqlca
integer x = 443
integer y = 288
integer width = 1422
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
integer x = 443
integer y = 200
integer width = 1422
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
integer x = 443
integer y = 112
integer width = 1422
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
integer x = 443
integer y = 24
integer width = 1422
integer height = 80
integer taborder = 50
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

event modified;wf_autobuiltmdflogname()
end event

type sle_dbpass from singlelineedit within w_set_sqlca
boolean visible = false
integer x = 443
integer y = 204
integer width = 1422
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 enabled = false
boolean autohscroll = false
boolean password = true
borderstyle borderstyle = stylelowered!
end type

type sle_userid from singlelineedit within w_set_sqlca
boolean visible = false
integer x = 443
integer y = 116
integer width = 1422
integer height = 80
integer taborder = 10
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
boolean visible = false
integer x = 443
integer y = 644
integer width = 1422
integer height = 80
integer taborder = 150
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
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
integer x = 18
integer y = 296
integer width = 407
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_5 from statictext within w_set_sqlca
integer x = 155
integer y = 212
integer width = 270
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_4 from statictext within w_set_sqlca
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
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
integer x = 128
integer y = 36
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 = 134217739
boolean enabled = false
string text = "数据库:"
alignment alignment = right!
boolean focusrectangle = false
end type

type st_00 from statictext within w_set_sqlca
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
integer x = 64
integer y = 120
integer width = 361
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 cb_ch2 from commandbutton within w_set_sqlca
integer x = 2112
integer y = 716
integer width = 114
integer height = 84
integer taborder = 40
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 sle_filename from singlelineedit within w_set_sqlca
integer x = 457
integer y = 720
integer width = 1655
integer height = 80
integer taborder = 30
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 cbx_addnewdatabase from checkbox within w_set_sqlca
integer x = 1353
integer y = 488
integer width = 503
integer height = 76
integer taborder = 160
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 255
long backcolor = 134217739
string text = "自动新建数据库"
end type

event clicked;IF THIS.CHECKED THEN 
	sle_userid.TEXT='SA'
	sle_dbpass.Text=''
	
	parent.height=1430
	sle_filename.ENABLED=TRUE
	cb_ch2.ENABLED=TRUE
	sle_sqldb_mdf.ENABLED=TRUE
	cb_sqldb_mdf.ENABLED=TRUE
	sle_sqldb_ldf.ENABLED=TRUE
	cb_sqldb_ldf.ENABLED=TRUE
	
	cbx_db_h.ENABLED=true
ELSE
	parent.height=700
	sle_filename.ENABLED=FALSE
	cb_ch2.ENABLED=FALSE
	sle_sqldb_mdf.ENABLED=false
	cb_sqldb_mdf.ENABLED=false
	sle_sqldb_ldf.ENABLED=false
	cb_sqldb_ldf.ENABLED=false
	
	cbx_db_h.ENABLED=false
END IF

cbx_db_h.postevent(clicked!)
end event

type rb_server from radiobutton within w_set_sqlca
integer x = 443
integer y = 492
integer width = 357
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
string text = "服务器模式"
end type

event clicked;
sle_dbms.triggerevent(selectionchanged!)
end event

type rb_2 from radiobutton within w_set_sqlca
integer x = 837
integer y = 492
integer width = 357
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
string text = "客户机模式"
end type

event clicked;
sle_dbms.postevent(selectionchanged!)

end event

type sle_dbms from dropdownlistbox within w_set_sqlca
boolean visible = false
integer x = 443
integer y = 28
integer width = 1422
integer height = 156
integer taborder = 210
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;cbx_addnewdatabase.enabled=ARROWADDNEW<>0 and rb_server.checked and sle_dbms.text='MSS Microsoft SQL Server 6.x' 
if not rb_server.checked then cbx_addnewdatabase.checked=false
if not cbx_addnewdatabase.checked then cbx_addnewdatabase.triggerevent(clicked!)
wf_findisql()
end event

event modified;sle_dbms.postevent(selectionchanged!)
end event

type st_8 from statictext within w_set_sqlca
integer x = 87
integer y = 736
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 = 134217739
boolean enabled = false
string text = "空数据库来自:"
alignment alignment = right!
boolean focusrectangle = false
end type

type sle_sqldb_mdf from singlelineedit within w_set_sqlca
integer x = 457
integer y = 812
integer width = 1655
integer height = 80
integer taborder = 80
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 sle_sqldb_ldf from singlelineedit within w_set_sqlca
integer x = 457
integer y = 904
integer width = 1655
integer height = 80
integer taborder = 90
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 st_91 from statictext within w_set_sqlca
integer x = 87
integer y = 828
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 = 134217739
boolean enabled = false
string text = "目标数据文件:"
alignment alignment = right!
boolean focusrectangle = false
end type

type st_912 from statictext within w_set_sqlca
integer x = 87
integer y = 920
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 = 134217739
boolean enabled = false
string text = "目标日志文件:"
alignment alignment = right!
boolean focusrectangle = false
end type

type cb_sqldb_mdf from commandbutton within w_set_sqlca
integer x = 2112
integer y = 812
integer width = 114
integer height = 84
integer taborder = 60
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,"MDF","MDF,*.MDF")
IF i=1 AND TRIM(pathname)<>'' AND TRIM(FILENAME)<>""  THEN
	IF RIGHT(LOWER(pathname),4)<>'.mdf' THEN
		MESSAGEBOX('','请输入MDF文件!')
		return
	END IF
 sle_sqldb_mdf.text=pathname
END IF

end event

type cb_sqldb_ldf from commandbutton within w_set_sqlca
integer x = 2112
integer y = 904
integer width = 114
integer height = 84
integer taborder = 70
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,"ldf","MS SQL Server日志ldf,*.ldf")
IF i=1 AND TRIM(pathname)<>'' AND TRIM(FILENAME)<>""  THEN
	IF RIGHT(LOWER(pathname),4)<>'.ldf' THEN
		MESSAGEBOX('','请输入ldf文件!')
		return
	END IF
 sle_sqldb_ldf.text=pathname
END IF

end event

type gb_1 from groupbox within w_set_sqlca
integer x = 64
integer y = 648
integer width = 2194
integer height = 364
integer taborder = 180
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
string text = "自动新建数据库"
end type

type st_193 from statictext within w_set_sqlca
integer x = 142
integer y = 504
integer width = 293
integer height = 60
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 41943040
long backcolor = 134217739
boolean enabled = false
string text = "工作模式:"
alignment alignment = right!
boolean focusrectangle = false
end type

type st_2334 from statictext within w_set_sqlca
integer x = 101
integer y = 1088
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
integer x = 101
integer y = 1180
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
integer x = 457
integer y = 1072
integer width = 1655
integer height = 80
integer taborder = 100
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 sle_sqldb_ldf_sor from singlelineedit within w_set_sqlca
integer x = 457
integer y = 1164
integer width = 1655
integer height = 80
integer taborder = 110
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 cbx_db_h from checkbox within w_set_sqlca
integer x = 101
integer y = 1016
integer width = 201
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 = 134217739
string text = "高级"
end type

event clicked;sle_sqldb_mdf_sor.enabled=this.checked
sle_sqldb_ldf_sor.enabled=this.checked
end event

type gb_3 from groupbox within w_set_sqlca
integer x = 64
integer y = 1016
integer width = 2194
integer height = 268
integer taborder = 170
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 134217739
end type

type st_jd from statictext within w_set_sqlca
integer x = 50
integer y = 416
integer width = 2226
integer height = 56
boolean bringtotop = true
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 16711680
long backcolor = 134217739
boolean enabled = false
alignment alignment = right!
boolean focusrectangle = false
end type

