Click here to Skip to main content
15,896,063 members

Comments by Varinder Raii (Top 20 by date)

Varinder Raii 18-Jul-16 2:48am View    
Thanks for your reply. I think you didn't see my question. I am doing in same way. But getting transaction related issue.
Varinder Raii 29-Nov-12 23:13pm View    
@OriginalGriff Thanks.....
Varinder Raii 12-Jul-12 4:22am View    
Sorry, I didn't get you, can you please elaborate.
Varinder Raii 9-Jun-12 5:41am View    
Actually i want to make a common method for master forms

which will retrieve data from database for all master forms. but problem is that

when reader retrieve data then how can i add this data to list.

For Ex.

Collapse | Copy Code

public static List<object> Retrieve(string TableName)
{
List<object> List = null;
using (var con = ClsCommon.ConnectionOpen())
{
using (var transaction = con.BeginTransaction())
{
string Qry = "Select * from "+TableName +"";
SqlCommand command = new SqlCommand(Qry ,con );
SqlDataReader Reader = command.ExecuteReader ();
if (Reader.HasRows )
{
while (Reader.Read ())
{
// Now here how can i add values from reader to List
}
}
}
}
return null;
}


I want to make a common method. is there any way for this problem. using Genric Class or any other thing.

Please help me i will be very thankful to you guys.
Varinder Raii 9-Jun-12 5:36am View    
Deleted
Actually i want to make a common method for master forms

which will retrieve data from database for all master forms. but problem is that

when reader retrieve data then how can i add this data to list.

For Ex.

public static List<object> Retrieve(string TableName)
{
List<object> List = null;
using (var con = ClsCommon.ConnectionOpen())
{
using (var transaction = con.BeginTransaction())
{
string Qry = "Select * from "+TableName +"";
SqlCommand command = new SqlCommand(Qry ,con );
SqlDataReader Reader = command.ExecuteReader ();
if (Reader.HasRows )
{
while (Reader.Read ())
{
// Now here how can i add values from reader to List
}
}
}
}
return null;
}


I want to make a common method. is there any way for this problem. using Genric Class or any other thing.

Please help me i will be very thankful to you guys.