Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I need to fetch multiple values from a query and want to assign these values in some variables.Bit I do not want to use a dataset or a datatable.

Can you suggest me some alternative?


Bye
Posted
Comments
Vivek Krishnamurthy 30-May-11 4:12am    
Can you please provide more details to your question ? An example would be very useful
Do you want to retrieve more than one row or more than one result set ?

You can however use DataReader.Read()for reading data for one row. Use DataReader.NextResult for start reading data for next result set.

1 solution

you can create a class to store this values... with some properties to store values
some thing like this

C#
class MyDataHolder
{


public string name{get;set}
public int no{get;set}

}


then in your query place if u r getting values
those values could be saved in the above properties may by embedding in a List

IList<mydataholder> myList = new List<mydataholder>();

MyDataHolder obj = new MyDataHolder();
obj.no = 10;
obj.Name = "blabala";

myList.Add(obj);


</mydataholder></mydataholder>
 
Share this answer
 
Comments
Sandeep Mewara 30-May-11 5:45am    
My 5!
arun_pk 31-May-11 6:31am    
thanks S Mewara
Kim Togo 30-May-11 6:15am    
Good answer, my 5.
arun_pk 31-May-11 6:31am    
Thanks Kim

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900