Private Sub Command1_Click() Dim fso As Object Dim SourcePath, TargetPath As String SourcePath = Text1.Text TargetPath = Text2.Text Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(TargetPath) Then fso.CopyFolder SourcePath & "*.*", TargetPath fso.CopyFile SourcePath & "*.*", TargetPath Else fso.CreateFolder (TargetPath) fso.CopyFolder SourcePath & "*.*", TargetPath fso.CopyFile SourcePath & "*.*", TargetPath End If Set fso = Nothing MsgBox "复制完成" End Sub
Private Sub Command2_Click() Dim fso As Object Dim TargetPath As String TargetPath = "D:\Test" Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFolder TargetPath, True Set fso = Nothing MsgBox "删除成功" End Sub
Private Sub DataGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DataGrid1.Row = DataGrid1.RowContaining(Y) MsgBox DataGrid1.Columns(0).Text End Sub
Private Sub Form_Load() Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=test;Data Source=SERVER" Adodc1.CommandType = adCmdText Adodc1.RecordSource = "select * from test" Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 DataGrid1.AllowUpdate = False End Sub
Private Sub Form_Load() Dim conn As ADODB.Connection Dim rst As ADODB.Recordset
Set conn = New ADODB.Connection Set rst = New ADODB.Recordset conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=test;Data Source=SERVER"