473,395 Members | 2,798 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,395 software developers and data experts.

SQL database table ot SQL schema

Hi there,

what is the easiest way i can call a SQL Query statement, eg. "SELECT * FROM
CUSTOMER", and have something, either some kinda object or something else,
that will show me the fields that have been returned, possibly also with
their properties?

similar thing to the normal ASP:

for each field in recordset.fields....and so on.
thanks.
PM
Nov 18 '05 #1
2 918

"Paul M" <mi******@hotmail.com> wrote in message
news:Ok****************@TK2MSFTNGP12.phx.gbl...
Hi there,

what is the easiest way i can call a SQL Query statement, eg. "SELECT * FROM CUSTOMER", and have something, either some kinda object or something else,
that will show me the fields that have been returned, possibly also with
their properties?

similar thing to the normal ASP:

for each field in recordset.fields....and so on.
thanks.
PM


Use a DataAdapter to fill a DataSet. The Tables within that have a Columns
collection.

private DataSet GetDataSet(string pCmdString)
{
DataSet ds;
SqlCommand cmd = new SqlCommand();
SqlConnection conn = new SqlConnection(_ConnStr); // the connection
string
cmd.Connection = conn;
cmd.CommandText = pCmdString; // a "select *" sql-query
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
try
{
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
ds = new DataSet();
da.Fill(ds);
}
finally
{
cmd.Connection.Close();
}
return ds;
}
Nov 18 '05 #2

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uC**************@TK2MSFTNGP11.phx.gbl...

"Paul M" <mi******@hotmail.com> wrote in message
news:Ok****************@TK2MSFTNGP12.phx.gbl...
Hi there,

what is the easiest way i can call a SQL Query statement, eg. "SELECT *

FROM
CUSTOMER", and have something, either some kinda object or something else,
that will show me the fields that have been returned, possibly also with
their properties?

similar thing to the normal ASP:

for each field in recordset.fields....and so on.
thanks.
PM


Use a DataAdapter to fill a DataSet. The Tables within that have a Columns
collection.

private DataSet GetDataSet(string pCmdString)
{

On that note, take a look at "Microsoft Application Blocks for .NET" located at
microsoft.com

MSDN Home > MSDN Library > .NET Development > Building Distributed Applications
with .NET > Microsoft Application Blocks for .NET

Mythran
Nov 18 '05 #3

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

Similar topics

2
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
19
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
10
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the...
7
by: mkarbarz | last post by:
Hello, I need to come up with a stored procedure that will allow me to read data from another database. The database I need to read the data from is a UniData residing on a Unix server. The...
8
by: situ | last post by:
Hello all, i have Database1 and database2, is it possible to make database connection to database2 by running stored procedure on database1. Thanks and Regards Situ
12
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a...
3
by: karanbikash | last post by:
Hi , I would like to know : 1.how to find all the schema in my DB2 database on Main frame machine . 2. How to see all the tables for a given schema . 3. What are the default schema in Db2 on...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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
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,...
0
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.