ADO-数据库读取和写入

Dim con As New ADODB.Connection

Dim rs As New ADODB.Recordset

con.ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\桌面\cs\sjk.mdb;”

con.Open

con.Execute “INSERT INTO b1 (id, name,age) VALUES (‘6’, ‘fuhui’,6)”

rs.Open “select * from b1”, con

While Not rs.EOF

Print rs.Fields(“id”) & ” ” & rs.Fields(“name”)

rs.MoveNext

Wend

rs.Close

con.Close

Set rs = Nothing

Set con = Nothing

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注