VB定时修改数据库名称

时间:2013-06-09 02:42:23
【文件属性】:

文件名称:VB定时修改数据库名称

文件大小:2.91MB

文件格式:RAR

更新时间:2013-06-09 02:42:23

VB 修改数据库名称

用VB6编写的代码 Private Sub Command2_Click() strconnect = "provider=SQLOLEDB;Persist Security Info=true;User Id='" & Tname & "';PassWord='" & Tpwd & "'; Initial Catalog=master;Data Source='" & Tserver & "'" If Conn.State = 1 Then Conn.Close Conn.Open strconnect 'GetSq Now sql = "select * from sysdatabases where name = '" & Tdatabase & "'" If rst.State = 1 Then rst.Close rst.CursorLocation = adUseClient rst.Open sql, Conn, adOpenStatic, adLockReadOnly 'If rst.EOF = True Then 'MsgBox "修改前的数据不存在,请检查!", vbInformation, "检查数据库是否存在" 'Exit Sub 'End If If rst.EOF = False Then Conn.Execute "exec sp_rename '" & Tdatabase & "','" & Tdatabase1 & "','database'" Else Conn.Execute "exec sp_rename '" & Tdatabase1 & "','" & Tdatabase & "','database'" End If 'MsgBox "执行完毕", vbOKOnly Unload Me End Sub


【文件预览】:
定时修改数据库名
----mydata.mdb(140KB)
----SQLRename.frm(7KB)
----SQLrename.exe(32KB)
----Class1.cls(409B)
----SQLrename.vbw(85B)
----Module1.cls(482B)
----setup.exe(3.03MB)
----mydata.ldb(64B)
----SQLrename.vbp(1KB)

网友评论