Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 23rd, 2009, 02:10 AM
Authorized User
Join Date: Sep 2009
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
Question adding Dropdown list Items from SQLSERVER 2005 database


m in great problem regarding dropdown list items.
I need to populate dropdownlist2 items depending on the selection of dropdownlist1 item.

Both dropdownlists will fetch values from Database table in Sql server 2005

Plz help me

Get the will power n U will be powered
Old October 23rd, 2009, 10:46 AM
Authorized User
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts

Option Explicit
Private Sub List1_Click()
Dim I As Integer, strSQL As String, SS As String
For I = 0 To List1.ListCount - 1
  If List1.Selected(I) = True Then
    SS = List1.List(I)
    Exit For
  End If
Next I
strSQL = "SELECT * FROM tablename WHERE fieldname = '" & SS & "'"
End Sub

Good Luck
The Following User Says Thank You to vb5prgrmr For This Useful Post:
biswa (October 23rd, 2009)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Placing database items into a list box hookenbook Visual Basic 2005 Basics 2 January 14th, 2009 08:56 PM
VB 2005 SqlServer database connection chandra7 ADO.NET 0 December 1st, 2008 10:20 AM
adding items to list box using javascript k.manisha ASP.NET 1.0 and 1.1 Professional 3 February 16th, 2007 06:32 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
Store Items from dropdown menu in mysql database scoobie PHP Databases 0 April 28th, 2005 08:17 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.