Http://www.asp888.net bean curd technology station
<% @ Import namespace = "system. data. SQL" %>
<% @ OutputCache Duration = "3600" %>
/*
The prefix of OutputCache indicates this page.
The length unit of the server holding time is seconds.
Now I set the retention time of this program to 3600, that is, an hour.
In this way, even if you change the database data, the program will not ignore it.
It still shows your unmodified data.
*/
<Script language = "vb" RUNAT = "server">
Sub Page_Load (myList AS Object, E as EventArgs)
Dim dbRead AS SQLDataReader
Dim dbComm AS SQLCommand
Dim SQLserver AS String
Dim SQL AS String
Conn = "server = localhost; uid = sa; password =; database = doufu"
This is another method for connecting to the database. We do not need to create a SQLConnection.
'Nature is actually the same
SQL = "Select * from msgboard"
DbComm = New SQLCommand (SQL, conn)
DbComm. ActiveConnection. Open ()
DbComm.exe cute (dbRead)
While dbRead. Read ()
Here we briefly introduce the simple operation methods for dropdownlist in asp +.
Test. items. add (New ListItem (dbRead. Item ("msgTitle ")))
End While
End Sub
</SCRIPT>
<Form runat = "server" method = "get">
<Asp: DropDownList id = "test" runat = "server"/>
</FORM>