Database
generate code for retrieving data from access to dropdownlist using asp.net
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajendra Deopura139 reputationPosted Dec 12, 2008, 10:56 PM EST
Dear
Create a table in access with three fields:
a. accno
b. name
c. balance
Create a temporary dataset with one method : GetAccountHolders()
Write The following code in Page Load:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim adapter As New DataSet1TableAdapters.bankinfoTableAdapter
Dim dt As DataTable = adapter.GetAccountHolders()
DropDownList1.DataSource = dt
DropDownList1.DataTextField = "Name"
DropDownList1.DataValueField = "accno"
DropDownList1.DataBind()
End Sub
Import the namespaces
a. System.Data
b. System.Data.OLEDB
Thanks
Pankaj Gupta66 reputationPosted Dec 17, 2008, 2:21 AM EST
You can generally write the code to get it from access and bind it with the drop down list. set the properties. if you require exact code plz provide the whole details so that we can help you.