Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 24, 2012 01:34 PM by march11
Apr 09, 2008 08:37 AM|LINK
Hi I'am practically new in C#, so I want to ask you guys some question.
Let say I have this query:
"Select EmployeeID, EmpName from PI_Employee"
How can I retrieve the result from EmployeeID column and EmpName column and put it into collections of array, so I can call the array and use it again in another function. Can I possibly do that in C# ? if so, how ? please help me guys, I'm on the edge of
nervous wreck in here so I could use a little help, any kinds of help. Thanks.
Apr 09, 2008 11:44 AM|LINK
Sounds to me that you are uncomfortable working with DataSets?
Consider using DataSets instead of Arrays, they are easier to use. And you can pass them on in functions.
I will give you a simple code here:
To access your data
where XXX is the row index (0 to dataSet.Tables.Rows.Count) and YYY is the column you want to access like "EmployeeID"
Hope this helps.
Jul 24, 2012 01:34 PM|LINK
The probelm with your solution is that you can not query datasets.
An array can be queried using Linq for example.
Datasets do have some advantages but also some short comings. I often pass them in web services requests because they are typed.