473,320 Members | 1,910 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,320 software developers and data experts.

Running Select query against dataTable

VMI
How can I run a Select query from a datatable so that it only brings the
fields I want? For example, if my datatable has 30 fields, a query would be
"select custId, Name" because those are the only two fields I need. Then I'd
like to put the result in another datatable.

Thanks.
Nov 16 '05 #1
1 14449
VMI,

You can't perform selects in that manner from a DataTable. The best you
can do is call the Select method, and pass a filter based on column values
(the documentation for the Select method will tell you how you can construct
a filter). Once you do that, you can take the rows returned, and copy only
the columns you want from each row to a new data table.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"VMI" <vo******@yahoo.com> wrote in message
news:Om****************@tk2msftngp13.phx.gbl...
How can I run a Select query from a datatable so that it only brings the
fields I want? For example, if my datatable has 30 fields, a query would
be "select custId, Name" because those are the only two fields I need.
Then I'd like to put the result in another datatable.

Thanks.

Nov 16 '05 #2

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

Similar topics

3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
1
by: microsoft.news.com | last post by:
is it possible to run a SELECT statement against a datatable, and if so how? this is what i have, its populating an excel document, I have my dataset, creatig a data table, now i need to group the...
1
by: Adam Clark | last post by:
Hi Is it possible to run a query against a dataset. For example, I want to create a new table and I read somewhere that ADO.NET does not support creating tables in access without the use of sql...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
3
by: phonl | last post by:
I am a vb6 ADO developer looking at vb.net 2005 and ADO2.net. I used the vb.net 2005 data wizard to bind some controls to a database. Now I want to run a select query and have the bound controls...
1
by: jasonlakewhitney | last post by:
I have an MDB on my PC with 3 linked tables to a SQL database. I only have permissions on the SQL db to insert and delete records. The linked tables are LnktblA, LnktblB, LnktblC and the main MDB...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
2
by: DotNetDanjo | last post by:
I want a stored procedure to run a select query on it's own like this: Select *, user_id As UserId FROM CC_host.dbo.usr_table Where(email LIKE N'%@%usa.com') But from these results I want the...
6
by: fniles | last post by:
I am using VB.NET 2005 and Access database. My program uses a timer that kicks in every 1 min to read from a database and copy the dataset table to a datatable. This database is in a class called...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.