1. 程式人生 > >用VB連線MySQL資料庫模組(詳解)

用VB連線MySQL資料庫模組(詳解)

'  常用語句
'  conn.Execute "drop database db_vb"
'  conn.Execute "create database db_vb"
'  conn.Execute "use db_vb"
'  conn.Execute "create table test (id int primary key,name char(8) not null)"
'  conn.Execute "insert into test value (1,'abc')"
'  conn.Execute "insert into test value (2,'xyz')"
'  執行查詢
'  rs.Open "select * from test", conn
'  讀取資料集
'  Debug.Print rs.RecordCount '資料集數量
'  rs.MoveFirst
'  For Each fld In rs.Fields
'    Debug.Print fld.Name,  '列標題
'  Next
'  Debug.Print
'  Do Until rs.EOF
'    For Each fld In rs.Fields
'      Debug.Print fld.Value,
'    Next
'    rs.MoveNext
'    Debug.Print
'  Loop