| 发表于:2007-05-19 16:12:469楼 得分:10 |
public readonly property backup() as boolean get me.tmp_command.commandtext = "backup database " & me._name & " to disk= ' " & me._path & " ' with name= ' " & me._name & " backup all ',description= 'full backup of " & me._name & " ' " try me.tmp_connection.open() me.tmp_command.EXECutenonquery() return true catch return false finally if me.tmp_connection.state = connectionstate.open then me.tmp_connection.close() end if end try end get end property public function restock(byref tmppb as toolstripprogressbar) as boolean dim tmp_i as integer dim tmp_ii as integer dim tmp_killer as string me.tmp_exestr = "select spid from sysprocesses where dbid = (select dbid from sysdatabases where name like ' " & me._control & " ') " try me.doconnect() me.tmp_flag = true me._dataset.clear() me.tmp_connection.open() tmppb.value = 5 me.tmp_adapter = new sqlclient.sqldataadapter(me.tmp_exestr, me.tmp_connection) me.tmp_adapter.fill(me._dataset, "systemdb ") tmppb.value = 10 tmp_ii = me._dataset.tables( "systemdb ").rows.count for tmp_i = 0 to tmp_ii - 1 tmppb.value += tmp_ii * fix(85 / tmp_ii) tmp_killer = "kill " + ctype(me._dataset.tables( "systemdb ").rows(tmp_i).item(0), string) me.tmp_command.commandtext = tmp_killer me.tmp_command.EXECutenonquery() next me.tmp_exestr = "restore database " & me._control & " from disk= ' " & me._path & " ' with recovery " me.tmp_command.commandtext = me.tmp_exestr me.tmp_command.EXECutenonquery() tmppb.value = 90 me.tmp_exestr = "alter database " & me._control & " set online " me.tmp_command.commandtext = me.tmp_exestr me.tmp_command.EXECutenonquery() tmppb.value = 100 catch me.tmp_flag = false finally me._name = me._control me.doconnect() end try return me.tmp_flag end function | | |
|