473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Retrive record from database in combobox

1
I want to rerive the record from database table into combobox.Plz do reply me how should i do this in ASP
Apr 2 '08 #1
1 1648
jeffstl
432 Expert 256MB
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

Expand|Select|Wrap|Line Numbers
  1.  
  2. dim ComboRS,ComboSQL
  3. Set ComboRS = Server.CreateObject("ADODB.Recordset")
  4. ComboSQL = "Select column_name from MyTable"
  5. ComboRS.Open ComboSQL , dbconn, adOpenStatic
  6.  
  7. While not EquipRS.EOF
  8.      response.write "<option>" 
  9.      response.write ComboRS ("column_name")
  10.      response.write "</option>"
  11.      ComboRS.MoveNext
  12. wend
  13.  
  14. ComboRS.Close
  15. Set ComboRS = Nothing
  16.  
  17.  
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.
Expand|Select|Wrap|Line Numbers
  1. dim dropdownsql ,dropcomm,dropread
  2. dropdownsql = "Select column_name From MyTable"
  3. dropcomm=New OleDbCommand(dropdownsql,DBConnection)
  4. dropread=dropcomm.ExecuteReader()
  5. DrpDwnID.DataSource=dropread
  6. DrpDwnID.DataBind()
  7.  
Apr 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record...
2
by: Paolo | last post by:
Friends, I have created a form named FRMNEWCLIENTS whose record source is a table named NEWCLIENTS. This table has a field named FILENUMBER. I have added on the form a combobox using the third...
6
by: Bernd Smits | last post by:
Hi, I would like to delete a record (with commandbutton) of a table associated to a combobox, when I select a certain value in the combobox (the value I select is associated with the record that I...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
6
by: Matt | last post by:
I'm not entirely sure how to describe this issue. I have a number of ComboBoxes in my application which have their text properties bound to a field in a data set. The items loaded in the ComboBox...
2
by: Gian Paolo | last post by:
Hi all on .net 2.0 i have a dataset and a table with some rows. Is there a way to retrive the current row index ? So i can retrive other value of that column... something like...
4
by: khyati30 | last post by:
hi, i am working on asp i am facing problem in asp , combox i want to retrive data in textbox , from combobox . in combobox , when i select particular user , i want to fetch that regarding...
1
by: Kevin Welch | last post by:
Looking for some expert help here. Caveat: I do not know SQL, and I've built a database basically by trial and error (unfortunately, I don't have much time to learn Access as I would want). ...
1
by: sandip007 | last post by:
hi All i am working on vb.net 8 i am using sql server. i am using pubs database question is :- i want to retrive all column name from single table and all these column name...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.