Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi there guys, I've managed to populate a dataset with a table (from a SQL query), and I'm trying to access the data in it directly instead of binding it to a dataGrid. How would I go about this? Say I had the following Table:

 

ID Name Password

1 Bob BobsPassword

2 Colin ColinsPassword

 

I want something like:

 

dataG.Column["name"].Row[0] to equal "bob"

dataG.Column["id"].Row[1] to equal "2"

 

I can't seem to navigate my way through the web of properties myself - please help!

Chaos is merely logic beyond human comprehension
Posted
Never mind peeps, after perusing the net some more I've found the solution. I need to create DataRows to handle the data, row at a time. Thanks anyway!
Chaos is merely logic beyond human comprehension
Posted

FZelle - cheers for the code. It didn't work, but after a bit off playing with it it was fine like this:

 

dataG.Tables[0].Rows[0]["Name"]

 

The Tables[0] part was omitted - do you know what the Tables index actually refers to? I'd imagine there should only be two dimensions for a table...

Chaos is merely logic beyond human comprehension
Posted

Every dataset has a collection of datatable. So the index in the Tables[0] refer to the first table filled in the dataset. If I remember correctly, you could also access it using Tables["yourtablename"]. This way is easier to be certain which datatable you're accessing.

 

Try reading MSDN for the structure of DataSet. You'll find enough reference to get you started.

Amir Syafrudin
Posted
Once again, you guys have proved that your .NET (ninja) skills know no bounds. Cheers again, I appreciate the help!
Chaos is merely logic beyond human comprehension

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...