473,395 Members | 1,969 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.

getting database table schema

Hi!

A question about database tables...
I have a SELECT statement:
SELECT something FROM someTable WHERE code = @code

The parameter code starts with 1 and is autoincremented...

Now I want to add a row to the database and I do it like this:
DataSet dataSet = new DataSet();
dataAdapter.SelectStatement.Parameters[0].Value = 0; // *
dataAdapter.Fill(dataSet); //
*
dataSet.Tables[0].AddRow(....);

The question is about the two rows marked with a *... I do this only to get
the schema of the table...
Is there anyother way to get the schema of the table? And can you the update
just the DataTable, without
it being in a DataSet?

thanks,
saso
Nov 15 '05 #1
3 5280
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in
news:bp**********@planja.arnes.si:
Hi!

A question about database tables...
I have a SELECT statement:
SELECT something FROM someTable WHERE code = @code

The parameter code starts with 1 and is autoincremented...

Now I want to add a row to the database and I do it like this:
DataSet dataSet = new DataSet();
dataAdapter.SelectStatement.Parameters[0].Value = 0; // *
dataAdapter.Fill(dataSet);
// *
dataSet.Tables[0].AddRow(....);

The question is about the two rows marked with a *... I do this only
to get the schema of the table...
Is there anyother way to get the schema of the table? And can you the
update just the DataTable, without
it being in a DataSet?

thanks,
saso


HI Saso,

Why don't you perform the update directly with an SqlCommand object if
you don't want to use the DataSet?

A dataTable can be used only in conjunction with a DataSet. So your only
chance is either to use the DataSet features or to stick with standalone-
commands.

greets
Peter

--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------
Nov 15 '05 #2
Thanks Peter!

Good point... I'll try and use the SqlCommand instead :)

saso

"Peter Koen" <koen-newsreply&snusnu.at> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
"Saso Zagoranski" <sa*************@guest.arnes.si> wrote in
news:bp**********@planja.arnes.si:
Hi!

A question about database tables...
I have a SELECT statement:
SELECT something FROM someTable WHERE code = @code

The parameter code starts with 1 and is autoincremented...

Now I want to add a row to the database and I do it like this:
DataSet dataSet = new DataSet();
dataAdapter.SelectStatement.Parameters[0].Value = 0; // *
dataAdapter.Fill(dataSet);
// *
dataSet.Tables[0].AddRow(....);

The question is about the two rows marked with a *... I do this only
to get the schema of the table...
Is there anyother way to get the schema of the table? And can you the
update just the DataTable, without
it being in a DataSet?

thanks,
saso


HI Saso,

Why don't you perform the update directly with an SqlCommand object if
you don't want to use the DataSet?

A dataTable can be used only in conjunction with a DataSet. So your only
chance is either to use the DataSet features or to stick with standalone-
commands.

greets
Peter

--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------

Nov 15 '05 #3
maybe this will help.
//------------------------------------------------------------------
DB_Connection.Open();
// Get the Table Names from DataBase
DB_SchemaTable =
DB_Connection.GetOleDbSchemaTable(System.Data.OleD b.OleDbSchemaGuid.Tables,
new object[] {null, null, null, "TABLE"});
// Reserve the Strings for the Table Names
sa_TableNames = new String[DB_SchemaTable.Rows.Count];
for (int i=0;i<DB_SchemaTable.Rows.Count;i++)
{
DataRow dr_Row = DB_SchemaTable.Rows[i];
// Store the Table Name
sa_TableNames[i] = dr_Row["TABLE_NAME"].ToString();
}

Mark Johnson, Berlin Germany
mj*****@mj10777.de
"Saso Zagoranski" <sa*************@guest.arnes.si> schrieb im Newsbeitrag
news:bp**********@planja.arnes.si...
Hi!

A question about database tables...
I have a SELECT statement:
SELECT something FROM someTable WHERE code = @code

The parameter code starts with 1 and is autoincremented...

Now I want to add a row to the database and I do it like this:
DataSet dataSet = new DataSet();
dataAdapter.SelectStatement.Parameters[0].Value = 0; // *
dataAdapter.Fill(dataSet); // *
dataSet.Tables[0].AddRow(....);

The question is about the two rows marked with a *... I do this only to get the schema of the table...
Is there anyother way to get the schema of the table? And can you the update just the DataTable, without
it being in a DataSet?

thanks,
saso

Nov 15 '05 #4

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

Similar topics

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...
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...
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: Brian Tkatch | last post by:
This is a shell question (bash), but i'm more familiar with this group, so i hope noone minds. I have a bash shell script which needs to query the database and return information into a...
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...
3
by: h4xPace | last post by:
I am building a MySQL query application, and I have run into a small snag. MySQL has released a set of classes that extend the .NET framework base data classes (command, connection, etc), and I am...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
0
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,...

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.