p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Pro VB Databases (http://p2p.wrox.com/forumdisplay.php?f=81)
-   -   adding Dropdown list Items from SQLSERVER 2005 database (http://p2p.wrox.com/showthread.php?t=76719)

biswa October 23rd, 2009 02:10 AM

adding Dropdown list Items from SQLSERVER 2005 database
 
Hi,

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

Thanks.

vb5prgrmr October 23rd, 2009 10:46 AM

Code:

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


All times are GMT -4. The time now is 10:09 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.