connectDB.txt
上传用户:voodooxm
上传日期:2008-04-23
资源大小:1k
文件大小:1k
- Private Sub Command1_Click()
- Text2 = Text1
- End Sub
- Private Sub connect_Click()
- Dim conn As New ADODB.Connection
- Dim cmd As New ADODB.Command
- Dim rs As New ADODB.Recordset
- 'connect to MySQL server using MySQL ODBC 3.51 Driver
- conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
- "SERVER=localhost;" & _
- "DATABASE=bs;" & _
- "UID=root;PWD=;OPTION=3"
- conn.Open
- cmd.CommandText = "select * from student"
- cmd.ActiveConnection = conn
- rs.CursorLocation = adUseClient
- rs.Open cmd, , adOpenStatic, adLockBatchOptimistic
- Do While Not rs.EOF
- pic.Print "Name: " & rs("sname")
- rs.MoveNext
- Loop
- 'cmd.CommandText = "create table ss(tt char(5))"
- 'cmd.ActiveConnection = conn
- 'cmd.Execute
- End Sub