-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNorthwindDataProvider.vb
More file actions
29 lines (23 loc) · 1.05 KB
/
NorthwindDataProvider.vb
File metadata and controls
29 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Imports System.Data
Imports System.Data.OleDb
Namespace RichEditImageMailMerge
Public Module NorthwindDataProvider
Private connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=False;"
Sub New()
Using connection As OleDbConnection = New OleDbConnection(connectionString)
Dim selectCommand As OleDbCommand = New OleDbCommand("SELECT * FROM Categories", connection)
Dim da As OleDbDataAdapter = New OleDbDataAdapter(selectCommand)
categoriesField = New DataTable("Categories")
da.Fill(categoriesField)
categoriesField.Constraints.Add("IDPK", categoriesField.Columns("CategoryID"), True)
selectCommand.Dispose()
End Using
End Sub
Private categoriesField As DataTable
Public ReadOnly Property Categories As DataTable
Get
Return categoriesField
End Get
End Property
End Module
End Namespace