access|ado|数据|数据库
Imports System.Data.OleDb
Module Module1
Sub Main()
' 首先设置对 System.Data.dll 的引用。
Dim objConn As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"User ID=Admin;" & _
"Data Source=C:\Northwind.mdb")
objConn.Open()
Dim objCmd As New OleDbCommand _
("SELECT * FROM Products", objConn)
Dim objDataReader As OleDbDataReader = objCmd.ExecuteReader
objDataReader.Read()
Console.Write(objDataReader.Item("ProductName") & ", " & _
objDataReader.Item("UnitsInStock"))
End Sub
End Module
时间: 2024-09-22 15:02:00