C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 2nd, 2012, 03:21 PM
Nullified's Avatar
Nullified Nullified is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 159 Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level)Nullified User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 19 h 23 m 37 sec
Reputation Power: 30
Lightbulb C# howto better handle array of data from mysql command

Code:
            command.CommandText = "SELECT id, name, urgency, lastreply FROM tbltickets WHERE status = 'Open'";
            connection.Open();
            Reader = command.ExecuteReader();
            while (Reader.Read()) {
                string thisrow = "";
                for (int i = 0; i < Reader.FieldCount; i++)
                    thisrow += Reader.GetValue(i).ToString() + ",";
                outputBox.Items.Add(thisrow);
            }
            connection.Close();

Instead of adding the data to the listbox and referring to the rowdata by 0/1/2/3 how can I pull the data by field name (iid, name, urgency, lastreply)?
string thisrow = "http://urliwant2go2.com/ticket.php?id="+Reader.GetValue('id').ToString();

Reply With Quote
  #2  
Old October 3rd, 2012, 05:00 AM
wren11 wren11 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 4 wren11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 17 sec
Reputation Power: 0
var id = reader["id"];

is this what u meant?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > C# howto better handle array of data from mysql command

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap