473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Populating a Combo box using a SqlDataReader

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
Nov 16 '05 #1
3 5854
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/quickst...ngPref=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" <ng******@gemssensors.com>
| Sender: "Neil Guyette" <ng******@gemssensors.com>
| Subject: Populating a Combo box using a SqlDataReader
| Date: Tue, 9 Dec 2003 16:08:31 -0800
| Lines: 11
| Message-ID: <05****************************@phx.gbl>
| 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
|

Nov 16 '05 #2
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
-----Original Message-----
Hi Neil,

Thanks for posting in the group!

SqlDataReader provides a means of reading a forward-only stream of rowsfrom 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/quickst...l/srcview.aspx ?lbLangPref=CP&path=/quickstart/howto/samples/adoplus/sqldtreader/sqldtreade r.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" <ng******@gemssensors.com>
| Sender: "Neil Guyette" <ng******@gemssensors.com>
| Subject: Populating a Combo box using a SqlDataReader
| Date: Tue, 9 Dec 2003 16:08:31 -0800
| Lines: 11
| Message-ID: <05****************************@phx.gbl>
| 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
|

.

Nov 16 '05 #3
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.
--------------------

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James | last post by:
I am using an sqldatareader and trying to add items from a sql select statement to a listview control. All columns from sql select statement are added into listview except one column that is a sql...
4
by: Lumpierbritches | last post by:
Thank you once again for any and all assistance. I'm building an application that's getting quite bulky due to the number of forms, macros and procedures. I was wondering if there's a way to use 1...
1
by: Patrick.O.Ige | last post by:
Doing the simple DropDown List binding using the method NextResult() But its just not populating .. what am i missing Its populating the 3 DropDwonList but no Data? Private Sub...
1
by: Adjo | last post by:
Okay, I've seen all the examples of using comboboxes on webforms when using simple values. And in the issue-tracker starterkit there is a way to use comboboxes with id/value foreign keys in a smart...
2
by: TS | last post by:
Hi all, From my windows form, I opened a connection to a SQL database. Now I need to generate a combo box from a SELECT statement pointing to the last name column in the SQL tables. I am stuck...
2
by: 5070707 | last post by:
Hi all this question might be more SQL oriented or at least database structure... i created a table in my SQL which contains 2 columns: 1. state 2. country the way i input the data is: State...
0
by: DeeJays | last post by:
hi I have table with following structure and data ID | LevelName | LevelNumber | ParentLevel 100 | AAA | 1 | 0 101 | BBB...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
7
by: blazted | last post by:
I am having a problem with populating a combo box from a Access DB, I am calling a stored procedure that executes with one row of values. i want to populate those values into my combo box but right...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.