473,607 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dataadapter.fil l

MDB
Hello All,

I have a data grid that I fill using a dataset. The results of the query
has around 15 columns and 500 rows (and growing). The reason I am using the
datagrid is so the end users can auto sort and page so I would like to keep
using the datagrid. My problem is that when I call DataAdapter.Fil l, it
takes a very long time and is even causing the web page to time out. Does
anyone know why the fill is taking so long (15-20 sec) or have any better
suggestions to display the records?

SQL Sent To Function
Select user_id, password, emailaddress, firstname, lastname, address, city,
state, zip, phonenumber, marketing, admin, status, last_order from users
where status = 'A'

Primary Key on user_id
Index on Status

public DataSet LoadDataset(str ing sql, string tableName, DataSet ds)
{
SqlCeCommand dc = new SqlCeCommand(sq l, conn, trans);

if (ds == null) {ds = new DataSet();}
if(ds.Tables[tableName]!=null){ds.Tabl es[tableName].Clear();}
if (tableName == null) {tableName = "Table";}
SqlCeDataAdapte r da = new SqlCeDataAdapte r(dc);
da.Fill(ds, tableName);

da.Dispose();
dc.Dispose();

return ds;
}
Jul 13 '06 #1
2 5218
Hi,
First of all, searching by text fields is very very slow and not efficient.
If You have to make selection on status ( which could be also numeric
field ) do this way, searching by numeric value is faster.
Your Code:
>SqlCeCommand dc = new SqlCeCommand(sq l, conn, trans);

if (ds == null) {ds = new DataSet();}
if(ds.Tables[tableName]!=null){ds.Tabl es[tableName].Clear();}
if (tableName == null) {tableName = "Table";}
SqlCeDataAdapte r da = new SqlCeDataAdapte r(dc);
da.Fill(ds, tableName);
try do this way:
ds = null;
ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(dt);
ds.Tables.add(d t)

this code is good when You use Dataset as a storage of one table, there is
no problem to create new table and fill it by dataadapter;-)

Adas
Użytkownik "MDB" <md*@nowhere.co mnapisał w wiadomo¶ci
news:u%******** ********@TK2MSF TNGP04.phx.gbl. ..
Hello All,

I have a data grid that I fill using a dataset. The results of the query
has around 15 columns and 500 rows (and growing). The reason I am using
the datagrid is so the end users can auto sort and page so I would like to
keep using the datagrid. My problem is that when I call DataAdapter.Fil l,
it takes a very long time and is even causing the web page to time out.
Does anyone know why the fill is taking so long (15-20 sec) or have any
better suggestions to display the records?

SQL Sent To Function
Select user_id, password, emailaddress, firstname, lastname, address,
city, state, zip, phonenumber, marketing, admin, status, last_order from
users where status = 'A'

Primary Key on user_id
Index on Status

public DataSet LoadDataset(str ing sql, string tableName, DataSet ds)
{
SqlCeCommand dc = new SqlCeCommand(sq l, conn, trans);

if (ds == null) {ds = new DataSet();}
if(ds.Tables[tableName]!=null){ds.Tabl es[tableName].Clear();}
if (tableName == null) {tableName = "Table";}
SqlCeDataAdapte r da = new SqlCeDataAdapte r(dc);
da.Fill(ds, tableName);

da.Dispose();
dc.Dispose();

return ds;
}

Jul 13 '06 #2
MDB
Thank you for your response. I will try switching the status to a numeric
value and using a datatable.

"tomodati" <ad************ ***@op.plwrote in message
news:e9******** **@nemesis.news .tpi.pl...
Hi,
First of all, searching by text fields is very very slow and not
efficient. If You have to make selection on status ( which could be also
numeric field ) do this way, searching by numeric value is faster.
Your Code:
>>SqlCeComman d dc = new SqlCeCommand(sq l, conn, trans);

if (ds == null) {ds = new DataSet();}
if(ds.Tables[tableName]!=null){ds.Tabl es[tableName].Clear();}
if (tableName == null) {tableName = "Table";}
SqlCeDataAdapt er da = new SqlCeDataAdapte r(dc);
da.Fill(ds, tableName);

try do this way:
ds = null;
ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(dt);
ds.Tables.add(d t)

this code is good when You use Dataset as a storage of one table, there is
no problem to create new table and fill it by dataadapter;-)

Adas
Użytkownik "MDB" <md*@nowhere.co mnapisał w wiadomo¶ci
news:u%******** ********@TK2MSF TNGP04.phx.gbl. ..
>Hello All,

I have a data grid that I fill using a dataset. The results of the query
has around 15 columns and 500 rows (and growing). The reason I am using
the datagrid is so the end users can auto sort and page so I would like
to keep using the datagrid. My problem is that when I call
DataAdapter.Fi ll, it takes a very long time and is even causing the web
page to time out. Does anyone know why the fill is taking so long (15-20
sec) or have any better suggestions to display the records?

SQL Sent To Function
Select user_id, password, emailaddress, firstname, lastname, address,
city, state, zip, phonenumber, marketing, admin, status, last_order from
users where status = 'A'

Primary Key on user_id
Index on Status

public DataSet LoadDataset(str ing sql, string tableName, DataSet ds)
{
SqlCeCommand dc = new SqlCeCommand(sq l, conn, trans);

if (ds == null) {ds = new DataSet();}
if(ds.Tables[tableName]!=null){ds.Tabl es[tableName].Clear();}
if (tableName == null) {tableName = "Table";}
SqlCeDataAdapt er da = new SqlCeDataAdapte r(dc);
da.Fill(ds, tableName);

da.Dispose() ;
dc.Dispose() ;

return ds;
}


Jul 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4553
by: JJ | last post by:
Hi, I created a DataAdapter, connection object and dataset generated from DataAdapter by dragging DataAdapter compenent to win form. Now in the code behind I want to use that DataAdapter. I go to use the dataset that was generated from DataAdapter and I get an Object ref error. So do I have to go through the steps in code behind to reinitate the SqlDataAdapter and DataSet that I generated on the form? If so whats the purpose of having...
1
1799
by: yma | last post by:
Hi, I tried to use a listbox to display a column in MS Access 2000 nwind.mdb by using ole DataAdapter, Connection and dataset controls. But I got "It is already opened exclusively by another user, or you need permission to view its data." I put ole DataAdapter, Connection and dataset controls and fill in the properties of the listbox. The only code I have is OleDbDataAdapter1.Fill(DataSet11, "employees") in page_load sub. How can I...
20
1656
by: TJ Doherty | last post by:
Need help understanding the following please: When I am creating a project and code my connection using Dim connectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Temp\NW-test.MDB", everything works correctly when I run the project. However, if I set up the exact same connection using the DataAdapter wizard and try to run the project, I get a "Microsoft Jet database engine cannot open the file..." error.
13
2077
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an OleDbCommand with an SQL String and the connection it has a DataAdapter with the command then it fills the DataSet's DataTable with the streamed data.
8
2686
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. Example: I have a dataadapter that contains one table with one row. I change the value of the 'FisrtName' column in that row from Jack to John. I call ..update on the dataadapter it goes through fine. Now I change that same column in that same row...
2
13948
by: susan.f.barrett | last post by:
Hi, Despite me being able to type the following in to SQL Server and it updating 1 row: > updatestockcategory 1093, 839 In my code, it is not updating any rows. dataSet = new DataSet();
6
13986
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection = conn da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1" da.Update(tblx) '--tblx/tbl1 not getting updated here.
3
12501
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand = New SqlCommand da.SelectCommand.Connectoin = conn da.SelectCommand.CommandType = Command.Text da.SelectCommand.CommandText = "insert Into tbl1 Select * from tbl2" da.SelectCommand.ExecuteNonQuery
0
4544
by: mike1402 | last post by:
Hi ! I get the error below sometimes when retrieving a big amount of data using Datadapter.Fill(dataset,"table"). But when I send the command Fill again, there is no error. Is it a fault of IBM.Data.DB2.iSeries; Version: v1.0.3705 (is there an newer one for OS/400 Version ist V5R3 ?) or is it a hardware faoult (memory of as400 or pc) ? br mike Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein...
0
8049
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7985
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8469
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8463
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8322
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6803
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3953
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4013
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.