Current location: Hot Scripts Forums » Programming Languages » C/C++ » Populating Combo box with data from a database(^_^!!)


Populating Combo box with data from a database(^_^!!)

Reply
  #1 (permalink)  
Old 02-08-04, 02:44 AM
solostar*** solostar*** is offline
New Member
 
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Populating Combo box with data from a database(^_^!!)

hi guys

Im doing an Windows apllicaton in Visual C++. Totally new at it. I need to retrieve information from the database to populate the combo boxes. How do I go about doing it?? Im using a ODBC connection and Microsoft Acess. I dont know what other information i have to provide.

Hope you can help me on this.. =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 02-08-04, 09:13 AM
hyjacked hyjacked is offline
Wannabe Coder
 
Join Date: Nov 2003
Location: New Brunswick, Canada
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
I've never done it with vc++ but I've done it with vb several so I know the process of getting it done.

First off you need to get the data from the database that you want to show on the form. First connect to the server. When you connect you save a handle in a variable, usually conn or something similar so you know that that is your connection to the database. With this variable you would need to run an SQL statement to get the data you want. When you get the data you want, it will be stored in what is called a recordset. You then process the recordset sort of like an array, only instead of cells and indexing it like an array, you move from one record to the next with a command like recordset.movenext(); As you move through each record, add it to the combo box.

You would need to complete this process for each combo box.

Another way to do this would be to link the box directly to the combo box. This method is not as powerful as the SQL version, and I'm not sure anymore how to do it, but I know it is possible, or it is in vb anyways.

Hope this helps, if you have anymore questions, feel free to post back.
__________________
hyjacked
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 02-23-04, 03:29 AM
solostar*** solostar*** is offline
New Member
 
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your help!~

I managed to do it... *phew* =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem getting data from DataGrid on update petersza ASP.NET 5 10-20-04 12:37 AM
load data in combo box AlexGM14 PHP 1 12-29-03 09:15 PM
How to Extract Intra Day Stock Price Data from Java Chart??? (only source of data!!) omkarsnisal Everything Java 0 10-29-03 03:25 AM
retrieve data from combo box sasi ASP 1 09-03-03 07:16 PM


All times are GMT -5. The time now is 01:57 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.