Dim cn As OleDbConnection、OleDbDataAdapter 是什么意思?vb.net和access数据库连接
ImportsSystem.Data.OleDbPublicClassForm1DimcnAsOleDbConnectionDimdaAsOleDbDataAdapter...
Imports System.Data.OleDb
Public Class Form1
Dim cn As OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As DataSet
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim cnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\persons.mdb;Persist Security Info=False"
cn = New OleDbConnection(cnStr)
Dim sql As String = "select * from grade"
da = New OleDbDataAdapter(sql, cn)
ds = New DataSet
da.Fill(ds, "grade")
DataGridView1.DataSource = ds.Tables(0)
End Sub
End Class
有没有大神能帮我解释一下每一句话,刚入门,真的看不太懂! 展开
Public Class Form1
Dim cn As OleDbConnection
Dim da As OleDbDataAdapter
Dim ds As DataSet
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim cnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\persons.mdb;Persist Security Info=False"
cn = New OleDbConnection(cnStr)
Dim sql As String = "select * from grade"
da = New OleDbDataAdapter(sql, cn)
ds = New DataSet
da.Fill(ds, "grade")
DataGridView1.DataSource = ds.Tables(0)
End Sub
End Class
有没有大神能帮我解释一下每一句话,刚入门,真的看不太懂! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询