锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国内精品在线播放,亚洲午夜av,欧美日韩一区在线播放http://www.aygfsteel.com/yczz/category/19205.htmlzh-cnWed, 28 Feb 2007 03:14:44 GMTWed, 28 Feb 2007 03:14:44 GMT60- VB瀹炵幇SQL SERVER2000鏁版嵁搴撳浠借繕鍘?/title>http://www.aygfsteel.com/yczz/articles/93658.html椋為笩椋為笩Sat, 13 Jan 2007 13:25:00 GMThttp://www.aygfsteel.com/yczz/articles/93658.htmlhttp://www.aygfsteel.com/yczz/comments/93658.htmlhttp://www.aygfsteel.com/yczz/articles/93658.html#Feedback0http://www.aygfsteel.com/yczz/comments/commentRss/93658.htmlhttp://www.aygfsteel.com/yczz/services/trackbacks/93658.html'* 鍚嶇О錛欱ackupDatabase
'* 鍔熻兘錛氬浠芥暟鎹簱
'* 鎺т歡錛氫竴涓枃鏈鍜屼袱涓寜閽紙澶囦喚鍒板拰紜畾錛?br />'*********************************************************
Public Sub BackupDatabase()
Dim cn As New ADODB.Connection
Dim s_path, s_dataexport As String
s_path = App.Path
Me.MousePointer = 11聽 聽'璁劇疆榧犳爣鎸囬拡褰㈢姸
'student1鏄渶瑕佸浠界殑鏁版嵁搴撳悕縐?br />s_dataexport = "backup database student1 to disk='" + CommonDialog1.FileName + "'"
cn.Open "driver={sql server};server=" & d1 & ";database=student1;persist security info=false; userid=sa"聽聽'鏁版嵁搴撹繛鎺ュ瓧絎︿覆
'榪欓噷涓嶉渶瑕佽繛鎺aster鏁版嵁搴擄紝鍗沖彲瀹屾垚澶囦喚
cn.BeginTrans
cn.Execute s_dataexport
Err.Number = 0
If Err.Number = 0 Then
聽 聽 cn.CommitTrans
聽 聽 MsgBox "鏁版嵁澶囦喚鎴愬姛錛?, vbInformation, "鎻愮ず"
聽 聽 MsgBox "鏁版嵁澶囦喚鏂囦歡瀛樻斁璺緞:" & CommonDialog1.FileName, vbOKOnly, "鎻愮ず"
聽 聽 Unload Me
Else
聽 聽 cn.RollbackTrans
聽 聽 MsgBox "鏁版嵁澶囦喚澶辮觸錛佽媯鏌ユ暟鎹簱鏄惁姝e湪鎵撳紑錛?, vbCritical, "鎻愮ず"
End If
cn.Close
Set cn = Nothing
Me.MousePointer = 1
End Sub
'*********************************************************
'* 鍚嶇О錛歊estoreDataBase
'* 鍔熻兘錛氳繕鍘熸暟鎹簱
'* 鎺т歡錛氫竴涓枃鏈鍜屼袱涓寜閽紙 鎵撳紑鍜岀‘瀹氾級
'*********************************************************
Public Sub RestoreDataBase()
If Text1.Text = "" Then
聽 聽 MsgBox "璇烽夋嫨瑕佹仮澶嶇殑鏁版嵁鏂囦歡錛?, vbInformation, "鎻愮ず"
聽 聽 Exit Sub
Else
聽 聽 ret = MsgBox("鏁版嵁鎭㈠鎿嶄綔灝嗕細瑕嗙洊浠ュ墠鐨勬墍鏈夋暟鎹茍涓旇鐩栧悗鏃犳硶鎭㈠錛屾?zhèn)嫯瀹氳杩涜鎭㈠鎿嶄綔鍚楀Q?, vbQuestion + vbOKCancel, "鎻愮ず")
聽 聽 If ret = vbOK Then
聽 聽聽 聽 Dim cn As New ADODB.Connection
聽 聽聽 聽 Dim sn As New ADODB.Recordset
聽 聽聽 聽 Dim s_restore As String
聽 聽聽 聽 Me.MousePointer = 11
聽 聽聽 聽 cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;server=" & d1 & ";Initial Catalog=master;Data Source=127.0.0.1;user id=sa;password=" & d3 & ""
聽 聽聽 聽 sn.Open "select聽聽spid聽聽from聽聽sysprocesses聽聽where聽聽dbid=db_id('student1')", cn
聽 聽聽 聽聽聽Do While Not sn.EOF
聽 聽聽 聽聽 聽 cn.Execute "kill " & sn("spid")
聽 聽聽 聽聽 聽 sn.MoveNext
聽 聽聽 聽聽聽Loop
聽 聽聽 聽聽聽sn.Close
聽 聽聽 聽聽聽s_restore = "restore database student1 from disk='" + Trim(Text1.Text) + "'聽聽with REPLACE"
聽 聽聽 聽聽聽cn.Execute s_restore
聽 聽聽 聽聽 聽'Debug.Print gs_conn_string
聽 聽聽 聽聽 聽'姝ゆ椂闇瑕佽繛鎺aster鏁版嵁搴撴墠鑳藉畬鎴愭暟鎹仮澶嶆搷浣?br />聽 聽聽 聽聽 聽'鍚屼笂student1涓洪渶瑕佹仮澶嶇殑鏁版嵁搴?br />聽 聽聽 聽聽聽s_restore = "restore database student1 from disk='" + Trim(Text1.Text) + "'"
聽 聽聽 聽聽 聽'text1涓涓敤浜庤褰曢渶瑕佹仮澶嶆枃浠剁殑鍦板潃鐨則extbox
聽 聽聽 聽聽聽cn.Execute s_restore
聽 聽聽 聽聽聽cn.BeginTrans
聽 聽聽 聽聽聽If Err.Number = 0 Then
聽 聽聽 聽聽 聽聽 聽cn.CommitTrans
聽 聽聽 聽聽 聽聽 聽MsgBox "鏁版嵁鎭㈠鎴愬姛錛?, vbInformation, "鎻愮ず"
聽 聽聽 聽聽 聽聽 聽Command1.Enabled = True
聽 聽聽 聽聽 聽聽 聽Label1.Visible = False
聽 聽聽 聽聽聽Else
聽 聽聽 聽聽 聽聽 聽cn.RollbackTrans
聽 聽聽 聽聽 聽聽 聽MsgBox "鏁版嵁鎭㈠澶辮觸錛?, vbCritical, "鎻愮ず"
聽 聽聽 聽聽 聽聽 聽Command1.Enabled = True
聽 聽聽 聽聽聽End If
聽 聽聽 聽聽聽cn.Close
聽 聽聽 聽聽聽Set cn = Nothing
聽 聽聽 聽聽聽Me.MousePointer = 1
聽 聽 Else
聽 聽聽 聽聽聽Exit Sub
聽 聽 End If聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽 '''''''''''''''''''''''''''''''''''''''''
聽 聽 On Error Resume Next
聽 聽 Dim DBC As New DataBaseConnection
聽 聽 If db.State = 1 Then
聽 聽聽 聽 db.Close
聽 聽 End If
聽 聽 db.ConnectionString = DBC.SqlConnectString(d1, d2, d3)
聽 聽 rs.CursorType = adOpenDynamic
聽 聽 rs.CursorLocation = adUseClient
聽 聽 rs.LockType = adLockOptimistic
聽 聽 db.CursorLocation = adUseClient
聽 聽 db.Open
聽 聽 Set cmd.ActiveConnection = db
聽 聽 If Err.Number Then
聽 聽聽 聽 MsgBox Err.Description, 16 + vbOKOnly, Err.Number
聽 聽聽 聽 Exit Sub
聽 聽 End If
聽 聽 db.DefaultDatabase = "student1"
聽 聽 If Err.Number Then
聽 聽聽 聽 MsgBox Err.Description, 16 + vbOKOnly, Err.Number
聽 聽聽 聽 Exit Sub
聽 聽 End If
End If
End Sub聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽 '''''''''''''''''''''''''''''''''''''''''''''
]]>
主站蜘蛛池模板:
阿鲁科尔沁旗|
河北区|
辽阳县|
盐边县|
若羌县|
宁德市|
左贡县|
宜兰市|
永泰县|
广昌县|
比如县|
剑河县|
蒲城县|
思南县|
六盘水市|
墨竹工卡县|
民和|
化隆|
卓尼县|
西宁市|
城口县|
许昌县|
广宗县|
大埔区|
淄博市|
平泉县|
襄城县|
海兴县|
商河县|
石嘴山市|
定远县|
仪陇县|
扶风县|
遵化市|
龙南县|
郧西县|
新化县|
延川县|
陆良县|
城口县|
茂名市|