Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Mysql query to cmb box. (how to)


Reply
 
Thread Tools Display Modes
  #1  
Old 09-28-2003, 04:12 AM
ThadNZ ThadNZ is offline
Regular
 
Join Date: Jun 2003
Location: NZ
Posts: 50
Default Mysql query to cmb box. (how to)


I'm trying to query my Mysql db to get info onto a combo box for a clien tlist (cmbclient).

I'm trying to populate a combo box with values returned from my Mysql DB. I can get the query to run ok. but i dont know how to feed the output into the combo box. Can anyone have a look at this for me. i'd be very appreciative.

Cheers
Brian



Code:

Dim sql As String

CloseRs

sql = "SELECT * FROM cl_master Where cl_name"
Set rs = cn.Execute(sql)
CheckError
Reply With Quote
  #2  
Old 09-28-2003, 04:22 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,887
Default

You have to loop through all records in the recordset and add each item to the combobox
Reply With Quote
  #3  
Old 09-28-2003, 05:03 AM
ThadNZ ThadNZ is offline
Regular
 
Join Date: Jun 2003
Location: NZ
Posts: 50
Default

OK,

So i've added the below code, but still nothing. I dont know muh anout sql querying, but is there anything obvious i'm leaving out here?




Dim sql As String
Dim Cl_Name As String

CloseRs

sql = "SELECT * FROM cl_master Where cl_name"
Set rs = cn.Execute(sql)
With rs
Combo1.Clear
Do While Not .EOF
Combo1.AddItem .Fields(Cl_Name).Value
.MoveNext
Loop
End With
CheckError
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Network SQL Application m4cc4 Database and Reporting 7 08-27-2003 08:37 AM
Using ‘Like’ in a Crosstab Query ID Crisis Word, PowerPoint, Outlook, and Other Office Products 2 03-13-2003 08:24 AM
Using ‘Like’ in a Crosstab Query ID Crisis Database and Reporting 0 03-13-2003 04:23 AM
[Microsoft][ODBC Driver Manager] Does not support this parameter? (MySQL query) James McMurray Database and Reporting 10 05-15-2002 10:09 AM
How to compare an empty value in a query.. pragash Database and Reporting 1 10-22-2001 11:12 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->