vb怎么调出access数据库中某一项的数据
展开全部
Dim Con As New ADODB.Connection '定义ADO对象
Dim Rs As New ADODB.Recordset
Private Sub Command1_Click()
If Text1.Text = "" Then '控制增加值不能为空
MsgBox "请正确输入年龄", 48, "提示信息"
Else
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb;Persist Security Info=False"
Con.Open
Set Rs = Con.Execute("UPDATE 学生基本信息 SET 年龄= 年龄+" + Text1.Text + "") '修改表语句
Con.Close
End If
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb;Persist Security Info=False" '刷新ADO控件
Adodc1.RecordSource = "select * from 学生基本信息"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb;Persist Security Info=False" '初始化ADO控件
Adodc1.RecordSource = "select * from 学生基本信息"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询