老师给了一个例子是读取database文件的
我现在想添加或者删除数据怎么弄?
我的读取代码如下:
Dim StrMemoryConnection As String = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & _
Application.StartupPath & "\playlist.mdb"
Dim strSQLMem As String
Dim dtMem As New DataTable()
Dim intTotalRows As Integer
Dim intCurrentRow As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dtMem.Clear()
strSQLMem = ("SELECT * FROM playlist")
Dim dataAdapter As New OleDb.OleDbDataAdapter(strSQLMem, StrMemoryConnection)
dataAdapter.Fill(dtMem)
dataAdapter.Dispose()
intTotalRows = dtMem.Rows.Count
intCurrentRow = 1
DisplayRecord()
End Sub
Private Sub DisplayRecord()
Me.txtOrder.Text = CStr(dtMem.Rows(intCurrentRow)("Order"))
Me.txtTitle.Text = CStr(dtMem.Rows(intCurrentRow)("Title"))
Me.txtAlbum.Text = CStr(dtMem.Rows(intCurrentRow)("Album"))
Me.txtArtist.Text = CStr(dtMem.Rows(intCurrentRow)("Contributing artists"))
Me.txtGenre.Text = CStr(dtMem.Rows(intCurrentRow)("Genre"))
Me.txtYear.Text = CStr(dtMem.Rows(intCurrentRow)("Year"))
Me.txtURL.Text = CStr(dtMem.Rows(intCurrentRow)("URL"))
End Sub