The above problem has not been solved, the new problem is coming again. The book has always been used in ado.net, but today I am not successful today. Please teach the master in the Internet. He said that asp.net is basically not using ADO (note: he is said to be ADO, not ado.net), then I will go online to find an instance of the connection database, the result is as he said . Now use OLEDB to connect, I downloaded an instance to do research. At the same time, he also sent a new textbook to me.
If it is a problem with my book, things may be a bit trouble. Then I have to change a textbook, or go to the library, oh ...
Basic confirmation ADO.NET seems no longer being applied, so I decided to use OLDB later. The source code of the connection is as follows:
★ ASP.NET Connect Access Database Ride ★
Hello everyone, the following is the routine about the ASP.NET to connect the Access database,
Share here and share:
ASP.NET Connection ACCESS Database Ride Detailed:
<% @ Import namespace = "system.data"%>
<% @ Import namespace = "system.data.oledb"%>
DIM MyConnection As OledbConnection
DIM MyCommand as Oledbcommand
SUB Page_Load (Sender As Object, E as Eventargs)
'1. Connect the database
Dim dbname as string
DBNAME = Server.mappath ("authors.mdb")
MyConnection = New OLEDBCONNECTION ("provider = microsoft.jet.Oledb.4.0; data source =" & dbname)
MyConnection.Open ()
La1.text = "Connection Opened!"
'2. Add record
MyCommand = New OLEDBCommand ("INSERT INTO AUTHORS (Authors, Country) Values ('Simson', '
USA
') "", myconnection)
Mycommand.executenonQuery ()
La2.text = "new record inserted!"
'3 update data (Access)
Mycommand = new oledbcommand ("Update Authors Set Authors = 'SIMSON'", MyConnection
Mycommand.executenonQuery ()
La3.text = "RECORD Updated!"
'4 Delete Data (Access)
Mycommand = new oledbcommand ("delete from authors where authors = 'david'", myconnection)
Mycommand.executenonQuery ()
La4.text = "Record deleted!"
'5 Display data using Dategrid
MyCommand = New OLEDBCommand ("Select * from authors", myconnection)
MyDataGrid.DataSource = mycommand.executeReader ()
MyDataGrid.Database
End Sub
script>
Bordercolor = "Black" Borderwidth = "1" Gridlines = "Both" Cellpadding = "3" Cellspacing = "0" Font-name = "verdana" Font-size = "10pt" Headerstyle-backcolor = "# aaaadd" AlternatingItemStyle-BackColor = "# eeeeee" > ask: DataGrid> body> html>