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>