473,508 Members | 3,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate collection object with field names from SQL table?

I could use a little help on this seemingly arcane objective.
Aug 11 '08 #1
3 2317
On Aug 11, 1:51*pm, "HillBilly" <someb...@somewhere.comwrote:
I could use a little help on this seemingly arcane objective.
I am assuming you are using some flavour of Microsoft SQL.

There are a couple of ways I have heard of to get the column names
from SQL. If you are trying to get the column names from a table
without actually getting any data, you can run a select query on the
INFORMATION_SCHEMA.Columns view. But if you are running a select on a
table, say like a SELECT * ..., and you want the column names in the
resultset, you can use either the GetSchema method, or you can load
the data from a DataAdapter to a DataSet, and then to a DataTable,
where the DataTable object has a collection of Columns and it has a
Name property.
Aug 11 '08 #2
Thanks for the leads...

<za***@construction-imaging.comwrote in message
news:7a**********************************@m73g2000 hsh.googlegroups.com...
On Aug 11, 1:51 pm, "HillBilly" <someb...@somewhere.comwrote:
I could use a little help on this seemingly arcane objective.
I am assuming you are using some flavour of Microsoft SQL.

There are a couple of ways I have heard of to get the column names
from SQL. If you are trying to get the column names from a table
without actually getting any data, you can run a select query on the
INFORMATION_SCHEMA.Columns view. But if you are running a select on a
table, say like a SELECT * ..., and you want the column names in the
resultset, you can use either the GetSchema method, or you can load
the data from a DataAdapter to a DataSet, and then to a DataTable,
where the DataTable object has a collection of Columns and it has a
Name property.

Aug 12 '08 #3
How To Retrieve Column Schema by Using the DataReader GetSchemaTable Method
and Visual C# .NET
http://support.microsoft.com/kb/310107
<za***@construction-imaging.comwrote in message
news:7a**********************************@m73g2000 hsh.googlegroups.com...
On Aug 11, 1:51 pm, "HillBilly" <someb...@somewhere.comwrote:
I could use a little help on this seemingly arcane objective.
I am assuming you are using some flavour of Microsoft SQL.

There are a couple of ways I have heard of to get the column names
from SQL. If you are trying to get the column names from a table
without actually getting any data, you can run a select query on the
INFORMATION_SCHEMA.Columns view. But if you are running a select on a
table, say like a SELECT * ..., and you want the column names in the
resultset, you can use either the GetSchema method, or you can load
the data from a DataAdapter to a DataSet, and then to a DataTable,
where the DataTable object has a collection of Columns and it has a
Name property.

Aug 19 '08 #4

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

Similar topics

10
1794
by: ynott | last post by:
I have an Access database with 58 fields in one table. I wrote many of the field names so that they were descriptive so that others could figure it out in the future. As an example, one field...
3
18502
by: Tom | last post by:
Data is collected over time in an Excel worksheet with 20 columns. The Excel worksheet starts out as a copy of a template as is filled in as data is collected. Eventually the worksheet file is...
1
2931
by: Clay Reitsma | last post by:
I want to populate a combo box with a list of all of the field names in a database (ie. more than one table). I want the user to be able to select any field name to be used in an on the fly query....
1
1533
by: John | last post by:
I have two fields on a form. Once called School, the second called SchoolZip I want the users to be able to go to the ComboBox field called School, select the school they want, and have it auto...
1
12739
by: Mal | last post by:
Hello. I have inherited a badly designed database and am trying to improve it. It is basically a flat file for survey results. one table holds, Name, Age etc as well as a field for each...
5
2593
by: EiEiO | last post by:
Hi All, I am trying to create an Import Form to "Map Fields" for importing many different tables into 1. The form I created has 2 columns of comboboxes ( A - AA) thru (J - JJ). The...
3
2707
by: Billy | last post by:
I do a SELECT * from table command in an ASP page to build a text file out on our server, but the export is not to allow a field name rows of records. The first thing I get is a row with all the...
4
22466
by: Bob | last post by:
Hi all, I've got a table that I've imported and it has junk at the top of the table, so after import I run a delete query to remove the junk lines then I'm left with the field names I want for...
4
1800
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, In my vb2005 app I create 3 datatables in the Datasource area, tbl1, tbl2, tbl3. tbl1 contains 1 column, tbl2 contains 2 columns tbl3 contains 3 columns. Based on selections from a...
0
7228
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,...
0
7128
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...
0
7393
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...
1
7058
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...
0
5635
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 project—planning, coding, testing,...
1
5057
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...
0
4715
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...
0
1565
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 ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.