I've added a dataset , and a table adapter to my C# project.
In this query , I get table data , then filter , then I will iterate and fill a listbox.(The dataset and tableadapter was added via DataSources boxes)

listBox1.Items.Clear();
            ETPDataset.t_USR_UsersDataTable tbl = (new ETPDataset.t_USR_UsersDataTable());
            ETPDatasetTableAdapters.t_USR_UsersTableAdapter tblAdap = new TestIntellisenseSql.ETPDatasetTableAdapters.t_USR_UsersTableAdapter();
            tblAdap.Connection.ConnectionString = scon.ConnectionString;
             tblAdap.Fill(tbl);
            ETPDataset.t_USR_UsersRow[] rows2;
            rows2 = (ETPDataset.t_USR_UsersRow[])tbl.Select("USR_RECORDID > 60");
             foreach (ETPDataset.t_USR_UsersRow
                drow in rows2)
            {
                listBox1.Items.Add(drow.USR_UserID);
            }

This is my problem

tblAdap.Fill(tbl);

, this line of code will fetch ALL data(problem for big tables) , how can i fix it ?
-Thanks

I found the answer.Here it goes.
I have to edit the query in the Dataset Designer.
The original query is

SELECT     dbo.t_USR_Users.*
FROM         dbo.t_USR_Users

but then change it to

SELECT     dbo.t_USR_Users.*
FROM         dbo.t_USR_Users
WHERE     (USR_RecordID > @ID)

Then as last step , when I query the data to return a table

tbl = tblAdap.GetData(60);//GetData method now accepts parameter
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.