I want to rerive the record from database table into combobox.Plz do reply me how should i do this in ASP
This code assumes you have set up a database connection string called dbconn. Also I am using ADODB in this example which works well with MS Access.
I am also assuming you are talking about classic ASP in the first example .
If you need help with connection strings
www.connectionstrings.com -
-
dim ComboRS,ComboSQL
-
Set ComboRS = Server.CreateObject("ADODB.Recordset")
-
ComboSQL = "Select column_name from MyTable"
-
ComboRS.Open ComboSQL , dbconn, adOpenStatic
-
-
While not EquipRS.EOF
-
response.write "<option>"
-
response.write ComboRS ("column_name")
-
response.write "</option>"
-
ComboRS.MoveNext
-
wend
-
-
ComboRS.Close
-
Set ComboRS = Nothing
-
-
If you are referring to .NET this is the code.
You just bind your drop down box to a datareader. This assumes you have a database conenction set up called DBConnection.
-
dim dropdownsql ,dropcomm,dropread
-
dropdownsql = "Select column_name From MyTable"
-
dropcomm=New OleDbCommand(dropdownsql,DBConnection)
-
dropread=dropcomm.ExecuteReader()
-
DrpDwnID.DataSource=dropread
-
DrpDwnID.DataBind()
-