Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Code for filling up a combobox in ASP
Author:
Hemant D.
Website:
http://www.freeecommersetips.com
Submitted:
8/4/2009
Version:
ASP
Compatibility:
ASP3.0
Category:
Databases
Views:
5723
The code given below populates the combo box in ASP.
Declarations:
<% Dim Connectdata Dim Connectstring Dim SQLstring Dim Recorddata
Code:
Connectstring = "Provider=SQLOLEDB; Datasource=datasource; Database=Testdata; UID=user id of database; PWD= Password for database;" Set Connectdata = Server.Createobject("ADODB.Connection") Connectdata.connectionstring = Connectstring Connectdata.mode = Readwrite Connectdata.open Set Recorddata = Server.Createobject("ADODB.Recordset") SQLstring = "select * from testdata" Recorddata.open SQLString, Connectdata, [Locktypes for the database] Recorddata.movefirst %> < select name = cbobox > <%while rs.EOF <> true%> < option value = "<%Response.Write (recorddata("fieldname"))%>"> <% Response.Write(recorddata("fieldname")) %> <% recorddata.movenext wend %>
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement