473,568 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5874
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(simila r 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******@gemss ensors.com>
| Sender: "Neil Guyette" <ng******@gemss ensors.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+sb7FuJ4jS1J EThqZKLILpFlTng ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.vc
| Path: cpmsftngxa07.ph x.gbl
| Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:31048
| NNTP-Posting-Host: tk2msftngxa11.p hx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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!

SqlDataReade r provides a means of reading a forward-only stream of rowsfrom a SQL Server database(simila r 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******@gemss ensors.com>
| Sender: "Neil Guyette" <ng******@gemss ensors.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+sb7FuJ4jS1J EThqZKLILpFlTng ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.vc
| Path: cpmsftngxa07.ph x.gbl
| Xref: cpmsftngxa07.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:31048| NNTP-Posting-Host: tk2msftngxa11.p hx.gbl 10.40.1.163
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
1367
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 datetime data type. I get a narrowing conversion error when I attempt to add this column to list view, my syntax is cmdSearchResult = New...
4
2180
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 (one) unbound form, if all the fields are the same for multiple forms populating them with Queries? I have a makeshif menu form with command...
1
1895
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 Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Not IsPostBack Then Dim sqlConnection As SqlConnection = New SqlConnection...
1
1420
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 (but hard!) way. I think every developer needs bound comboboxes to store foreign keyvalues while displaying the user-friendly value as it is...
2
6990
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 with the code I should use to generate this combo box. I used to use ADO to open a connection to SQL in VB6 then use Do until EOF - Loop to loop...
2
4875
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 Country UK London
0
1372
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 | 100 102 | CCC | 2 | 100 103 | DDD | ...
2
3262
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 selecting from the combo box, I have all the combo boxes, using afterupdate, populating their respective list boxes. These text boxes are directly...
7
1512
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 now the combo box will not populate. here is my code. private void GetProductColors() { try { ...
0
7916
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8117
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6275
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.