If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Fields in a combo box

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-13-04, 12:22
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
Fields in a combo box

Can someone help me to find a way to view columns from SQL Server tables in a combo box? I don't want the data in the columns, I want the actual column names. I want the user to be able to pick the columns needed and run a query to get the data just from the columns chosen. I think what I need to do is run a SQL Server stored procedure from VB.
Thanks.

Last edited by exdter; 02-13-04 at 14:15.
Reply With Quote
  #2 (permalink)  
Old 02-17-04, 17:06
brianb99999 brianb99999 is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
Can't remember exactly, you need to use ADO's field object, the code goes something like this:

open connection to DB.
open the recordset (lets call it RSRecordset) with a SELECT * FROM tablename.
dim fldField as adodb.field
for each fldfield in rsrecordset
combobox.additem fldfield.name
next
Reply With Quote
  #3 (permalink)  
Old 02-18-04, 10:46
exdter exdter is offline
Registered User
 
Join Date: Aug 2003
Posts: 328
Thanks for your help. I'm going to just manually add the columns after all. I think if I took all the columns it would be too much for the user to look through.
Thanks again.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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