470,625 Members | 1,989 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,625 developers. It's quick & easy.

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 2830
"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Pepehammer | last post: by
2 posts views Thread by Jim Heavey | last post: by
2 posts views Thread by ven | last post: by
4 posts views Thread by Billy | last post: by
10 posts views Thread by dauphian | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.