Populating a Combo box using a SqlDataReader

  • Thread starter Thread starter Neil Guyette
  • Start date Start date
N

Neil Guyette

Hello, Everyone,

I'm trying to find information on how to populate a combo
box using a SqlDataReader. I want to be able to set the
value of the combo's value property different then the
combo's text property (what the user will see). Is this
possible with a SqlDataReader?

Thanks

-Neil
 
Hi Neil,

Thanks for posting in the group!

SqlDataReader provides a means of reading a forward-only stream of rows
from a SQL Server database(similar to a cached read-only recordset).
populate a combo box using a SqlDataReader,
If you have a valid SqlDataReader, you can manually retrieve data from that
SqlDataReader to populate a combo box.(no automatic way)

The following is a VC++ SqlDataReader sample program link:
http://samples.gotdotnet.com/quickstart/util/srcview.aspx?lbLangPref=CP&path
=/quickstart/howto/samples/adoplus/sqldtreader/sqldtreader.src


Best regards,
Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Neil Guyette" <[email protected]>
| Sender: "Neil Guyette" <[email protected]>
| Subject: Populating a Combo box using a SqlDataReader
| Date: Tue, 9 Dec 2003 16:08:31 -0800
| Lines: 11
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| thread-index: AcO+sb7FuJ4jS1JEThqZKLILpFlTng==
| Newsgroups: microsoft.public.dotnet.languages.vc
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vc:31048
| NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| Hello, Everyone,
|
| I'm trying to find information on how to populate a combo
| box using a SqlDataReader. I want to be able to set the
| value of the combo's value property different then the
| combo's text property (what the user will see). Is this
| possible with a SqlDataReader?
|
| Thanks
|
| -Neil
|
 
Mr. Chang,

Thanks for your reply.

I realized that the SqlDataReader is forward only, but
when coding an asp.net page and using a dropdownbox you
can bind it to a SqlDataReader. I found my solution last
night, instead of using a SqlDataReader I'm now using a
SqlDataAdapter. Using the SqlDataAdapter to fill a
DataSet object.

Once again thanks a lot.

Neil Guyette
 
Hi Neil,

Thanks for your quickly response!

We are very delightful to know you have found your resolution.

Thanks again for participating the community.


Best regards,
Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Back
Top