"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program " _ & "Files\Microsoft Office\Office10\Samples\Northwind.mdb" Dim cmd As OleDbCommand = New OleDbCommand() Dim paramProductID As New OleDbParameter() cmd.Connection = con .ParameterName = "inProductID" .OleDbType = OleDbType.Integer .Size = 4Working with MS Access Stored Procedures in VB.NET. Part 2
by David Wasserman, MCP
Article source code: msaccess_sp2.zip
Introduction
Welcome to part two of Access Stored Procedures. Part one described in detail how to create stored procedures in Access using ADO.NET and Visual Basic.NET. Part two will demonstrate how to utilize the stored procedures created in part one by assembling a Database Tier that can be modelled and used in your own applications. This article will describe in detail one implementation of a Database Tier for Visual Basic.NET.
The main purpose of the Database Tier is to provide a gateway to the database via a class module. This class module would act as the glue between the database and the application. There are two main advantages to using a data tier to access your database. You will have the ability to modify your underlying database technology (moving from MS Access to SQL Server for instance) without affecting your application in a major way. You will also be placing a control layer between your application and the database allowing you to ensure that all data is properly "cleansed". The Database Tier in .NET applications would most likely consist of a class module keeping in line with proper object-oriented coding conventions. Earlier versions of Visual Basic would employ a Standard Module to do the job.
Database Tier - Code
It''''s now time to roll up our sleeves and get dirty with some code. The first thing after adding an empty class declaration file is to pull in the proper .NET Framework libraries listed below.
Imports System.Data Imports System.Data.OleDb
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




