Basic syntax:
-------------------------------------------------- -------------------------
Set:
appsettings>
Call: (vb)
<% = ConfigurationSettings.appsettings ("keywordname")%>
Dim keyword as string = configurationSettings.appsettings ("keywordname")
First, set environment variables
-------------------------------------------------- -------------------------
Set:
Add to Web. Config,
appsettings>
......
Configure> configuration>
Call: (vb)
Can generate user controls .ascx files
>>>
>>
>>>>>>
Second, database connection
-------------------------------------------------- -------------------------
ACCESS
-----------------------------------
Set:
Add to Web. Config,
XML Version = "1.0" encoding = "UTF-8"?>
appsettings>
configure>
Call: (vb)
DIM DSN AS String = ConfigurationSettings.AppSettings ("Connectionstring")
SUB Page_Load (Send As Object, E AS Eventargs)
IF not ispostback.
OpenDatabase_and_bindtodatagrid ()
END IF
End Sub
Sub Changpage (Sender As Object, e as datagridpagechangedeventargs)
MyGrid.currentpageIndex = E.NewpageIndex
OpenDatabase_and_bindtodatagrid ()
End Sub
SUB OpenDatabase_and_bindtodatagrid ()
DIM CONN AS OLEDBCONNECTION, ADPT AS Oledbdataadapterdim DS AS Dataset, SQL AS String, I as Integer
DIM TABLE1 AS DATATABLE
Conn = New OLEDBCONNECTION (DSN)
Conn.open ()
SQL = "SELECT * from bbs_titles Order by Titles_LastPostDate DESC"
Adpt = New OLEDBDataAdapter (SQL, CONN)
DS = new dataset ()
Adpt.Fill (DS, "BBS_TITLES")
Table1 = DS.TABLES ("BBS_TITLES")
Table1.columns.add (New Datacolumn ("Titles_Date", GetType (String)))))
For i = 0 to Table1.Rows.count-1
DIM D1 As Date = Table1.Rows (i) .Item ("Titles_created")
DIM D2 AS DATE = Table1.Rows (i) .Item ("Titles_LastPostdate")
Table1.Rows (i) .Item ("Titles_Date") = Format (D1, "MM / DD") & "-" & format (d2, "mm / dd")
NEXT
Mygrid.datasource = Table1.defaultView
MyGrid.database
CONN.CLOSE ()
End Sub
script>
SQL Server
-----------------------------------
Set:
Add to Web. Config,
XML Version = "1.0" encoding = "UTF-8"?>
appsettings>
configure>
Call: (vb)
<% @ Import namespace = "system.data"%>
<% @ Import namespace = "system.data.sqlclient"%>
<% @ Import namespace = "system.configuration"%>