Asp.net connection access data warehouse routine details:
<% @ Import namespace = "system. Data" %>
<% @ Import namespace = "system. Data. oledb" %>
<SCRIPT Laguage = "VB" runat = "server">
Dim myconnection as oledbconnection
Dim mycommand as oledbcommand
Sub page_load (sender as object, e as eventargs)
'1. Connect to 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. Access)
Mycommand = new oledbcommand ("Update authors set authors = 'bennett 'Where authors = 'simson'", myconnection)
Mycommand. executenonquery ()
La3.text = "record updated! "
'4. Access)
Mycommand = new oledbcommand ("delete from authors where authors = 'David'", myconnection)
Mycommand. executenonquery ()
La4.text = "record deleted! "
'5 use dategrid to display data
Mycommand = new oledbcommand ("select * from authors", myconnection)
Mydatagrid. datasource = mycommand. executereader ()
Mydatagrid. databind ()
End sub
</SCRIPT>
<HTML>
<Body>
<Asp: Label id = "la1" runat = "server"/> <br>
<Asp: Label id = "La2" runat = "server"/> <br>
<Asp: Label id = "La3" runat = "server"/> <br>
<Asp: Label id = "la4" runat = "server"/> <br>
<Asp: DataGrid id = "mydatagrid" runat = "server"
Bordercolor = "black"
Borderwidth = "1"
Gridlines = "both"
Cellpadding = "3"
Cellspacing = "0"
Font-name = "verdana"
Font-size = "10pt"
Headerstyle-backcolor = "# aaaadd"
Alternatingitemstyle-backcolor = "# eeeeee"
>
</ASP: DataGrid>
</Body>
</Html>