?
Solved

Should be simple

Posted on 2005-03-29
6
Medium Priority
?
201 Views
Last Modified: 2010-05-19


I am trying to set a variable to the value in a dataset column/row

here is the code that i have


                                                string delimStr = ",.:";
                  char [] delimiter = delimStr.ToCharArray();
                  int x = 10;
                  string locations = dsLogins1.Tables[0].Columns["locations"].ToSring();
                  string [] splitlocations = locations.Split(delimiter , x);
                  foreach (string s in splitlocations)

The locations value that is held in the table is something like 23,100,241,221

When I do a debug and view the variable value of locations, it just is a string "locations"

How do I set the value of this to the variable?

Thanks,
Justin
0
Comment
Question by:jlazanowski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
sharpnet earned 2000 total points
ID: 13653358
Instead of referencing dsLogins1.Tables[0].Columns["locations"], which just gives you the column info, you need to be pointing to the row.  It should read :

sdLogins1.Tables[0].Rows[<index of row>]["locations"]

where <index of row> is the row you want.  For testing this can simply be 0.

Let me know if this works.  If not, please paste a large portion of your script (including the DataSet setup) so I can run a debug from here.

Nick
0
 
LVL 3

Expert Comment

by:sharpnet
ID: 13653369
oh, and don't forget the ToString() at the end of that statement.  I had removed for clarity.

Nick
0
 
LVL 1

Author Comment

by:jlazanowski
ID: 13653581
I put it on there..

One more questions semi related.

first I am using a drop down box to select a value. This dropdown is bound to the dataset (this is done in the desinger)

when the user presses a select button it binds to text boxes and a few check boxes to values in the dataset (the row the user selected)

My problem is how do I know what row the user selected, since this wasn't done in code but in the designer I am not aware of the row index.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:sharpnet
ID: 13653645
well, the follow up question should technically be a new question in the forums since it's a different type of question.  Just fair for the points...

But, my first thoughts are that when a user selects something from the dropdown box, they are not actually selecting a "row" from the dataset.  What you'll have to do is find the selectedindex or selecteditem from the dropdown box and, via code, find the row containing that information and make changes from there.  It shouldn't matter if your dataset and dropdown are bound via code or the designer, you're still looking at "item" objects from the dropdown box.  

If you make a new post for this question and paste some of your code, I can help you more with it.

Nick
0
 
LVL 1

Author Comment

by:jlazanowski
ID: 13661798
Nick,

Would you do me a favor and look at
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21368848.html

I am not getting the anwser that I am looking for and I though maybe a fresh set of eyes could help.

Thanks
0
 
LVL 3

Expert Comment

by:sharpnet
ID: 13661860
Yeah, I'll give it a shot.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question