01.
Dim
objConnection
As
OleDbConnection
02.
Dim
objCmd
As
OleDbCommand
03.
Dim
strConnection
As
String
04.
05.
strConnection =
"Provider=Microsoft.Jet.OLEDB.4.0;"
& _
06.
"Data Source=C:\\temp\\Northwind.mdb"
07.
08.
09.
objConnection =
New
OleDbConnection(strConnection)
10.
objConnection.Open()
11.
12.
13.
objCmd =
New
OleDbCommand()
14.
objCmd.Connection = objConnection
15.
objCmd.CommandText =
"[Sales by Category]"
16.
17.
objCmd.CommandType = CommandType.StoredProcedure
18.
19.
Dim
adapter
As
New
OleDbDataAdapter
20.
Dim
ds
As
New
DataSet
21.
Dim
dt
As
New
DataTable
22.
adapter.SelectCommand = objCmd
23.
adapter.Fill(ds)
24.
dt = ds.Tables(0)
25.
If
(dt.Rows.Count > 0)
Then
26.
For
index = 0
To
dt.Rows.Count - 1
27.
Console.WriteLine(dt.Rows(index)(0))
28.
Next
29.
30.
End
If
31.
Console.ReadLine()