VB添加Access数据库字段的代码
'先 工程->引用 : Microsoft Activex Data Object Library 2.1 Private Sub Text1_Change() Dim Sql As String, S As String S = Text1.Text If Len(S) <> 10 Then Exit Sub Dim Conn As New ADODB.Connection Dim Rs As New ADODB.Recordset Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\mydb.mdb" '请将路径换成你的数据库7a686964616fe4b893e5b19e31333236376632位置 Sql = "Select * From [Mydate]" '将Mydate换成你的表名 Rs.Open Sql, Conn, 1, 3 Rs.AddNew Rs(0) = Left(S, 5) '第一列 Rs(1) = Right(S, 5) '第二列 Rs.Update Rs.Close
修改Access数据库字段的代码
Dim conn As New ADODB.Connection Dim sql As String FileName = "d:\db1.mdb" DbPw = "操作员密码" conn = "provider=microsoft.jet.oledb.4.0;persist security info =false;data source=" & FileName & ";Jet OLEDB:Database Password=" & DbPw conn.Open sql = " update box set box.jin =box.jin+12" conn.Execute sql conn.Close Set conn = Nothing
运营不易,
感谢支持!
我的微信
我的微信公众号
我的微信公众号扫一扫
我的公众号