Last post Jul 24, 2012 09:34 AM by march11
Apr 09, 2008 04:37 AM|ryan_r|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 07:44 AM|ralph.varjabedian|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 09:34 AM|march11|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.