Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


If a dataset contains 100 rows, how to fetch rows between 10
and 20 only ?

Answers were Sorted based on User's Feedback



If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / tiger kumar

We have the option of the fetching the starting record and
the maximum record options.

_dataadapter.Fill(_dset,"Test",11,10);

It will retrieve the record from 11 to next 10 records.

Is This Answer Correct ?    11 Yes 2 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / avanish singh

_adapter.Fill(ds,11,10).
or By iterate record from 11 to 20.

Is This Answer Correct ?    7 Yes 1 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / suresh jayaraman

for(int
RowsCount=1;RowsCount<dataset.rows.count;RowsCount++)
{
if(RowsCount>10 && RowsCount<20)
{
//if you GirdView or DataGrid
Gridview1.DataSource=dataset;
GridView1.DataBind()

}
}

Is This Answer Correct ?    8 Yes 4 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / pra vesh hajela

SqlConnection conn = new
SqlConnection(AppConfiguration.ConnectionString);
SqlCommand cmd = new
SqlCommand("SelectCustomerInfo", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
//da.Fill(ds);
da.Fill(ds, 10, 10, "table");
return ds;

Is This Answer Correct ?    4 Yes 0 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / vijay

Dataset consists of DataTable collection which consists of
DataRows. Create Dataset object, then create DataRow object

Dim objRow as New DataRow

objRow(9) to objTow(19) woud give the rows between 10 and
20, as first row is stored with index 0.

Is This Answer Correct ?    7 Yes 4 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / raghwendra ji chaubey

SqlDataAdapter sda = new SqlDataAdapter(sqlquery , con);
DataSet ds = new DataSet();
sda.Fill(ds);
sda.Fill(ds, 3, 2, "SrcTables");

Is This Answer Correct ?    5 Yes 2 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / satyambabu

Dataset consists of DataTable collection which consists of
DataRows. Create Dataset object, then create DataRow object

Dim objRow as New DataRow

objRow(9) to objTow(19) woud give the rows between 10 and
20, as first row is stored with index 0.

Is This Answer Correct ?    5 Yes 3 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / abhishek_gp3

Use Overloaded Fill() function of SqlDataAdapter Class of System.Data.SqlClient namespace.

Fill(1,2);
1- Dataset object
2- Table name

Fill(1,2,3,4);
1- Dataset Object
2- Starting Rec.
3- End Rec.
4- Table Name
--
Sample prog:
------
using System;
using System.Windows;
using System.Data;
using System.Data.SqlDataAdapter;

Class FetchRec
{
SqlConnection Con;
SqlDataAdapter Adap;
Dataset ds;

Public FetchRec()
{
Con = new SqlConnection("initial catalog=master;integrated security=yes");
Con.Open();

Adap= new SqlDataAdapter("Select ID, Name from Employee where ID > 110");

ds= new Dataset();
}//constructor end

try{
ds = Adap.Fill(ds, 10, 20, "Employee");

int rcount=ds.Tables["Employee"].Rows.Count;

for(int i=0; i < rcount ; i++)
{
Console.Writeline(ds.Tables["Employee"].Rows[i][0] + ds.Tables["Employee"].Rows[i][1]);
}

con.close();
} //try end
catch(SqlException exp)
{
MessageBox.Show(exp.Message);
}

}//class end

Is This Answer Correct ?    3 Yes 1 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / vaidyanathan r.

DataRow[] dr = new DataRow[10];
for(int i = 10 to 19)
dr[i] = DataSet1.Tables[<TableIndex>].Rows[i];

DataRow array dr contains Records between 10 and 20.

Is This Answer Correct ?    3 Yes 2 No

If a dataset contains 100 rows, how to fetch rows between 10 and 20 only ?..

Answer / muthu kumar

DataSet ds = new DataSet();
ds.Load(cmd.ExecuteReader(),
LoadOption.OverwriteChanges, "sample");

DataRow[] dr = ds.Tables[0].Select("id>1 and id<10");

for (int i = 0; i < dr.Length; i++)
{
Response.Write(dr[i][0].ToString()+"<br>");


}

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More ADO.NET Interview Questions

Can we bind one datareader wid two dropdown list?

5 Answers  


How to maintain the relation between two tables in ADO.NET?

0 Answers   Petranics Solutions,


If we want to connect to many databases in dataaccess layer such as MSAccess,Sql server,oracle means not to a particular database depends on condition we have to connect to appropriate database in this scenario if we without changing code Ho wdo you handle this situation?

4 Answers   Honeywell,


how to display empty table to datagrid

3 Answers   LG Soft,


Difference between ADO and ADO.Net

4 Answers   IBM,


What is bubbled event?

0 Answers  


What is full form of ado?

0 Answers  


Which object needs to be closed?

0 Answers  


Which type of database is used while processing dynamic database?

1 Answers   Microsoft,


If a table contains 20000 records. In a page at each time 100 records to be displayed.

0 Answers  


How to add Primary key in DataSet

6 Answers  


Explain the advantages and disadvantages of using datalist?

0 Answers  


Categories