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 > C# control

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-12-03, 06:53
daboira daboira is offline
Registered User
 
Join Date: Dec 2001
Location: Barcelona
Posts: 32
Question C# control

I must to fill a combobox. My data source is an xml file. Wich is the better system to populate the combobox? I can do it with the traditional AddItem method, but I don't know if there is a better manner to do it. Thank you.
Reply With Quote
  #2 (permalink)  
Old 05-13-03, 15:53
Memnoch1207 Memnoch1207 is offline
Registered User
 
Join Date: Jan 2003
Location: Midwest
Posts: 138
i've never done it pulling from an xml file, but from a database you can do something like

Code:
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As String

set conn = "Driver={SQL SERVER};Server=myServer;Database=myDb;UID=me;PWD=****"

set sql = "SELECT name FROM tableName"

rs.Open(sql, conn, 3, 3)

do until rs.eof
   cboCombobox.AddItem(rs!name)
   rs.movenext
loop

set rs = nothing
set sql = nothing
set conn = nothing
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