473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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 2952
"Ryan Liu" <rl**@PowerCATI.comwrote in message
news:eg**************@TK2MSFTNGP03.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.org写 入消息
news:Or****************@TK2MSFTNGP05.phx.gbl...
"Ryan Liu" <rl**@PowerCATI.comwrote in message
news:eg**************@TK2MSFTNGP03.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
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: ...
2
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...
3
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
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...
0
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...
4
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...
10
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...
10
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=...
3
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.