如何使用ms-access在vb中连接数据库 [英] how connect database in vb using ms-access
本文介绍了如何使用ms-access在vb中连接数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用ms-access在vb中连接数据库
how to connect database in vb using ms-access
推荐答案
在Internet上搜索将为您带来数百万个结果.
我得到的第一个结果是此 [ ^ ]似乎
Searching on the internet will give you millions of results.
The first result I got was this[^] and it seemed useful.
Google可以毫无疑问地为您提供帮助,并且由于CP是google用来为编程提供解决方案的最重要的网站之一,因此我使用它为您提供了一些代码可以为您提供帮助.
Google can help you without any doubt,and because CP is one of the most important sites that google use to bring solutions on programming to,i have use it to give you some codes that can help you.
01 Imports System.Data.OleDb
02 Public Class DatabaseConnection
03 Private CommonConnection As OleDbConnection
04 Private CommaonDataAdapter As OleDbDataAdapter
05 Private CommonCommand As OleDbCommand
06 Private CommonDataSet As DataSet
07
08 Public Sub New()
09 CommonConnection = New OleDbConnection("provider=MicroSoft.jet.OLEDDB.4.0;" & "Data Source=..\db1.mdb;" & "persist Security Info=false")
10 CommonCommand = New OleDbCommand
11 CommonCommand.Connection = CommonConnection
12 CommonDataSet = New DataSet
13 End Sub
14 Protected ReadOnly Property p_CommonConnection() As OleDbConnection
15 Get
16 Return CommonConnection
17 End Get
18 End Property
19 Protected Property p_CommonDataAdapter() As OleDbDataAdapter
20 Get
21 Return CommaonDataAdapter
22 End Get
23 Set(ByVal Value As OleDbDataAdapter)
24 CommaonDataAdapter = Value
25 End Set
26 End Property
27 Protected ReadOnly Property p_CommonCommand() As OleDbCommand
28 Get
29 Return CommonCommand
30 End Get
31 End Property
32 Protected Property p_CommonDataSet() As DataSet
33 Get
34 Return CommonDataSet
35 End Get
36 Set(ByVal Value As DataSet)
37 CommonDataSet = Value
38 End Set
39 End Property
40
41 End Class
这篇关于如何使用ms-access在vb中连接数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文