- ImportsSystem.Data.OleDb
- DimMyConnectionAsNewOleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Application.StartupPath&"/Book.mdb")
- DimMyCommandAsOleDbCommand
- DimMyReaderAsOleDbDataReader
- DimdbsetAsNewDataSet
- DimdataAAsOleDbDataAdapter
- DimsqlAsString="SELECT*FROMBookWHEREBookNameLIKE'%"&&"%'""
- SELECT*FROMBookWHEREBookSHLIKE
- UPDATEBookSETBookAuthor=
- INSERTINTOBook(BookSH,BookAuthor)VALUES(
- Try
- dbset.Clear()
- MyConnection.Open()
- MyCommand=NewOleDbCommand(sql,MyConnection)
- dataA=NewOleDbDataAdapter(MyCommand)
- dataA.Fill(dbset,"Book")
- DataGridView.DataSource=dbset.Tables("Book")
- CatchcAsException
- MsgBox(c.ToString,MsgBoxStyle.OkOnly,"错误")
- EndTry
- MyConnection.Close()
- MyCommand.Dispose()
原文链接:https://www.f2er.com/vb/264417.html