读取和MDB文件 [英] Reading and MDB File
本文介绍了读取和MDB文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我是VB新手.在delphi中,读取mdb文件很简单
我添加了一个"ado查询"和一个表.将它们链接在一起.
我使用的代码是
ado.active:= false
ado.sql.text:=从表中选择*"
ado.active:= true
读取数据库并将其放入表中只有3行代码.
Hi
Im new to VB. In delphi it was simple to read a mdb file
I added an "ado query" and a table. Linked them together.
The code i used was
ado.active := false
ado.sql.text := "select * from table"
ado.active := true
It was 3 lines of code to read a database and put it into a table.
Is there no simple method like this to open a mdb file in vb?
推荐答案
如果您回头看一下delphi的工作,那不是那么简单-您是否有这样的简单方法?必须指定数据库,并建立连接.
与VB相同:
If you look back at your delphi work it wasn''t quite that simple - you had to specify the DB, and set up a connection as well.
It is the same with VB:
Using con As New SqlConnection(strConnect)
con.Open()
Using da As New SqlDataAdapter("SELECT * FROM myTable", con)
Dim dt As New DataTable()
da.Fill(dt)
myDataGridView.DataSource = dt
End Using
End Using
不仅可以填充表格,还可以显示表格...
That not only fills a table, but also displays it as well...
您需要使用ADO.NET类从访问中读取数据
一些有用的类r folows
OleDbConnection
OleDbDCommand
检查此链接
http://msdn.microsoft.com/en-us/library/ms971485.aspx [ ^ ]
祝你好运........
You need to use ADO.NET classes to read data from access
Some useful classes r as folows
OleDbConnection
OleDbDCommand
Check this link
http://msdn.microsoft.com/en-us/library/ms971485.aspx[^]
Best of luck........
要从VB.NET代码读取Access文件,请参见以下链接:
http://www.startvbdotnet.com/ado/msaccess.aspx [
Hi,
For reading Access file from VB.NET code, see the following link:
http://www.startvbdotnet.com/ado/msaccess.aspx[^]
这篇关于读取和MDB文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文