VB.NET连接ACCESS数据库
VB.NET连接上ACCESS数据库后,如何读取特定行列的数据并返回。 ACCESS?
[解决办法]
可通过select查询语句结合where 返回查询结果阿
[解决办法]
如通过字段与id号就可取指定行了,
Dim con As New OleDbConnection
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\data.mdb"
con.Open()
cmd.Connection = con
cmd.CommandText = "select 字段1 from table1 where ID=id"
dr = cmd.ExecuteReader()
If dr.Read() Then
TextBox2.Text = dr(0)
End If
dr.Close()
con.Close()