Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 23rd, 2009, 03: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

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.
__________________
Get the will power n U will be powered
Reply With Quote
  #2 (permalink)  
Old October 23rd, 2009, 11:46 AM
Authorized User
 
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts
Default

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
Reply With Quote
The Following User Says Thank You to vb5prgrmr For This Useful Post:
biswa (October 23rd, 2009)
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 06:41 AM
Store Items from dropdown menu in mysql database scoobie PHP Databases 0 April 28th, 2005 09:17 AM



All times are GMT -4. The time now is 09:20 AM.


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