473,549 Members | 2,906 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use DataAdpater fill datatable couple times for many columns

Hi,

If I have a very big view in database, it covers 15 tables, each table has
1000 columns.

When I issue select * from view, the database will give error -- too many
columns.

Can I use a DataAdapter fill DataTable couple times? For example, I only
read 5000 columns from the view each time and I read 3 times. It has an id
column as primary key to help locate the row.

How to write a DataAdapter to fill DataTable 3 times? What is the most
efficient way to do this?

Thanks a lot!

~.~.~.~.~.~.~.~ .~.~.~.~.~.~.~. ~.~.~.~.

Ryan Liu
Shanghai Fengpu Software Co. Ltd
Shanghai , China

http://www.PowerCATI.com Powerful CATI!
http://www.fpsoft.net.cn
~.~.~.~.~.~.~.~ .~.~.~.~.~.~.~. ~.~.~.~.

Jan 31 '08 #1
2 2965
"Ryan Liu" <rl**@PowerCATI .comwrote in message
news:eg******** ******@TK2MSFTN GP03.phx.gbl...
If I have a very big view in database, it covers 15 tables, each table has
1000 columns.

When I issue select * from view, the database will give error -- too many
columns.

Can I use a DataAdapter fill DataTable couple times? For example, I only
read 5000 columns from the view each time and I read 3 times. It has an id
column as primary key to help locate the row.

How to write a DataAdapter to fill DataTable 3 times? What is the most
efficient way to do this?
If you try to use a DataAdapter to fill the table three times, it will
attempt to add additional rows to the DataTable, rather than adding new
columns to the existing rows.
Instead of the DataAdapter, use a DataReader. Loop through the rows
returned by the datareader and add their data into the additional columns in
the datatable. You will have to create the columns beforehand in the table
(you can also do this with a looping construct). These loops take more work
to program than just using a DataAdapter, but they are equally efficient,
since it is what the dataadapter does internally anyway.

Jan 31 '08 #2

"Alberto Poblacion" <ea************ *************** ***@poblacion.o rg写入消息
news:Or******** ********@TK2MSF TNGP05.phx.gbl. ..
"Ryan Liu" <rl**@PowerCATI .comwrote in message
news:eg******** ******@TK2MSFTN GP03.phx.gbl...
>If I have a very big view in database, it covers 15 tables, each table
has 1000 columns.

When I issue select * from view, the database will give error -- too many
columns.

Can I use a DataAdapter fill DataTable couple times? For example, I only
read 5000 columns from the view each time and I read 3 times. It has an
id column as primary key to help locate the row.

How to write a DataAdapter to fill DataTable 3 times? What is the most
efficient way to do this?

If you try to use a DataAdapter to fill the table three times, it will
attempt to add additional rows to the DataTable, rather than adding new
columns to the existing rows.
Instead of the DataAdapter, use a DataReader. Loop through the rows
returned by the datareader and add their data into the additional columns
in the datatable. You will have to create the columns beforehand in the
table (you can also do this with a looping construct). These loops take
more work to program than just using a DataAdapter, but they are equally
efficient, since it is what the dataadapter does internally anyway.
Then what about I use a few DataAdapter fill a few DataTalbe and then merge
DataTables?

Thanks!

Jan 31 '08 #3

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

Similar topics

8
1920
by: Pepehammer | last post by:
Hi everybody! I got a combobox to fill. I want to display some information (Text), but when I select a item, I want to return a number. The info I want to fill in is something like this: TEXT VALUE Category1 10
2
15310
by: Jim Heavey | last post by:
Hello, I have done a little VB Programming and now I am giving C# a try. Right now I am working with Dataset and DataTables and there are a couple of compile errors that I would work in VB, but are apparently different in C#. If I want a table from a DataSet, in VB.Net I would enter the command as follows: Dim Table as DataTable =...
3
2389
by: Paulb1us | last post by:
I want to update records from a csv file. I do this in a button click: //Create Adapters da = new OdbcDataAdapter("Select * FROM test.csv", conn); //Fill a data table da.Fill(dt);
2
2112
by: ven | last post by:
Hello i have a dynamic datatable in my page. I wanna to write data to textboxes and after click on button "ADD data" i want to refresh datagrid on page... Here is my code : ' Insert page code here ' Dim wykszt as System.Data.DataTable Dim zatru as System.Data.DataTable Dim row as system.Data.DataRow
0
1050
by: Sam | last post by:
Hi, I can't achieve this. I want to fill a 3-columns datagrid with the result of a sql request for the first 2 column and the result of a stored procedure for the third column. My idea is to create a datatable first and populate it with the first sql request. I've got a dataset that contains the result of the request but I don't know how to...
4
1332
by: Billy | last post by:
My Busn tier returns a DataSet and I want to fill a DataAdapter in the presentation layer with that dataset. Problem is that if I create a DataAdapter in the presentation layer i need to specify a SqlCommand with it, but i don't want to, i just want to fill it with the DataSet from the Busn Tier. Any ideas on how you get round this?
10
6513
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I have one querie that grabs all of the id's I need for the other 4 queries, but I am not sure how to get them into a DataTable or DataSet, or if that...
10
4239
by: muskan | last post by:
hello, I have written this code on button_click event. but it shows "Object reference not set to an instance of an object" error. can u help to solve this error. String conn= "data source= VTECHS; database= bc;uid=greymount;password= manish2809"; String str= "select * from details"; SqlDataAdapter da= new SqlDataAdapter(str,conn);...
3
7390
by: ASPnewb1 | last post by:
I am currently filling a dataTable then adding this table to a dataset, setting the dataset to the Gridview's datasource. If I set the Gridview to generate columns automatically it will fill the grid just fine, but I can't get the automated column (column index 1) to be set to readonly. (Column 0 is actually an automated column of edit...
0
7487
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...
0
7758
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. ...
1
7517
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7844
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...
0
5126
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1978
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1093
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
800
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...

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.