Ado.net - Move next,move previous,move last and move first

Posted by Gayathri under ASP.NET on 12/19/2010 | Points: 10 | Views : 8154 | Status : [Member] | Replies : 3
Hi,

I need a code sample for Move previous,move next,move last ,move first in ado.net using C#


please help.




Responses

Posted by: Vuyiswamb on: 12/19/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
look at this article
http://www.codeproject.com/KB/database/SimulatingRecordsets.aspx

Thank you for posting at Dotnetfunda
[Administrator]

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/8/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

this link explains in details of the ADO.net concepts...

http://www.codeproject.com/KB/database/DatabaseAcessWithAdoNet1.aspx

Thanks
Karthik
www.f5Debug.net

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suresh.mekkattil on: 1/9/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,
You can do this by either SqlDataReader or DataSet.

Method using SqlSataReader

 SqlCommand Cmd = new SqlCommand();

Cmd.Connection = Condb;
Cmd.CommandType = CommandType.StoredProcedure;
Cmd.CommandText = SProc;
Open();

// This is for adding the SqlParameters
for (int i = 0; i < Param.Length; i++)
{
Cmd.Parameters.Add(Param[i]);
}
SqlDataReader dr = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
while(dr.read)
{
// Do your code here..
}




Method using DataSet

SqlCommand Cmd = new SqlCommand();

Cmd.Connection = Condb;
Cmd.CommandText = Sql;
Cmd.CommandType = CommandType.Text;
DataSet Ds = new DataSet();
Open();
for (int i = 0; i < Param.Length; i++)
{
Cmd.Parameters.Add(Param[i]);
}
SqlDataAdapter Sda = new SqlDataAdapter();
Sda.SelectCommand = Cmd;
Sda.Fill(Ds // Loop through the Tables in the dataset you.)







-----
Suresh M

Gayathri, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response