vb.net(2008)怎样连接Access数据库(2007)
我刚开始学习vb.net希望大家多多帮忙谢谢!还能在详细点吗?比如说能实现一个表的查询谢谢!...
我刚开始学习vb.net 希望大家多多帮忙 谢谢!
还能在详细点吗?比如说能实现一个表的查询 谢谢! 展开
还能在详细点吗?比如说能实现一个表的查询 谢谢! 展开
3个回答
展开全部
我没用的2008 ,这是2005里我写的
Dim constr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\zr.mdb;Jet OLEDB:Database Password=1234 "
Dim olecon As OleDbConnection
olecon = New OleDbConnection(constr)
Dim comstr As String = "select * from cb where cname='ww'"
Dim comm As New OleDbCommand(comstr, olecon)
Dim rr As OleDbDataReader
rr = comm.ExecuteReader
If rr.Read() Then
messagebox.show("查询记录成功")
rr.Close()
comm.Dispose()
olecon.Close()
olecon.Dispose()
End If
Dim constr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\zr.mdb;Jet OLEDB:Database Password=1234 "
Dim olecon As OleDbConnection
olecon = New OleDbConnection(constr)
Dim comstr As String = "select * from cb where cname='ww'"
Dim comm As New OleDbCommand(comstr, olecon)
Dim rr As OleDbDataReader
rr = comm.ExecuteReader
If rr.Read() Then
messagebox.show("查询记录成功")
rr.Close()
comm.Dispose()
olecon.Close()
olecon.Dispose()
End If
展开全部
MyConn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=数据库;"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim path As String = "D:\vb\TEXT\Sj\Sj\data\Access_2007.accdb"
Dim conn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & path & ";Jet OLEDB:Database Password=MyDbPassword;"
Dim conn As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & path & ";Jet OLEDB:Database Password=MyDbPassword;"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询