vb电脑已经没有了,很简单的程序。自己研究一下做做.
步骤:
1.连接数据库
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_ExpStu.mdb;Persist Security Info=False"
’连接字符串
Adodc1.RecordSource = "select * from tb_stu " ‘查询所有数据
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 ‘在DATAGRID1中显示出来
2.查询
查询主要代码
Private Sub Cmd_Find_Click()
If Text1.Text = "" Then
MsgBox "请输入要查询的学生编号", , "信息提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
MyInt = Val(Trim(Text1.Text)) '给变量赋值
Adodc1.RecordSource = "select * from tb_stu where 年龄= " + Str(MyInt) + ""
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End If
End Sub
温馨提示:内容为网友见解,仅供参考