C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Binding Data to DropdownList


Posted Date: 08 Mar 2007    Resource Type: Code Snippets    Category: ADO.NET

Posted By: Padma       Member Level: Diamond
Rating:     Points: 10



The Following sample shows the method of binding dropdownlist dynamically. Hee "Name" is the Text Field of the dropdownlist and "id" is the value Field.


Dim str As String = "data source=(local);" _
& "initial catalog=av;uid=sa;pwd=sa;"
Dim con As SqlConnection = New SqlConnection(str)
con.Open()

Dim ds As New DataSet
Dim da As SqlDataAdapter

Dim strSql As String = "Select * from tabTest"
da = New SqlDataAdapter(strSql, con)
da.Fill(ds)

// ddl is the name of the dropdown list.
ddl.Datasoucre = ds.Tables(0)
ddl.DataTextField = "Name"
ddl.DataValueField = "id"
ddl.DataBind()




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Data Relation between Two Different Datasets
Previous Resource: Sorting and Filtering a DataView
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

online optimum rewards

Contact Us    Privacy Policy    Terms Of Use