473,737 Members | 9,590 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 2981
"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
1944
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
15318
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 = ds.Tables("MyTable")
3
2413
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
2122
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
1057
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 loop on it and use it to fill the first two columns of the datatable. Does anybody know how to do...
4
1337
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
6539
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 is the best way to do this. Seperately the queries all work with no problems.
10
4251
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); SqlCommandBuilder commb=new SqlCommandBuilder(da);
3
7402
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 buttons) here's my code: DataSet ds = new DataSet(); DataTable dt = new DataTable();...
0
8968
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8786
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
9470
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
9334
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...
1
9258
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8207
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 projectplanning, coding, testing, and deploymentwithout 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...
1
6749
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6052
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
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...

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.