Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle ODT / ODAC create table with C# .Net

Re: Oracle ODT / ODAC create table with C# .Net

From: AlterEgo <alterego55_at_dslextreme.com>
Date: Mon, 19 Mar 2007 15:14:47 -0700
Message-ID: <12vu2shf5da2qd7@corp.supernews.com>


Drsnap,

Answers:

  1. select * from transactions where 1 = 2
  2. Use the ExecuteNonQuery() method
  3. You could serialize your objects into XML and then store the XML, but why use a relational database? Instead, you want an object database such as InterSystems Cache.
    • Bill

"DrSnap" <DrSnap_at_gmail.com> wrote in message news:1174295593.039391.201810_at_p15g2000hsd.googlegroups.com...
> Hi,
>
> Admitted I am a newbie to Oracle (databases in general) but now Ive
> installed the Oracle DB v.10g and the ODAC development tools for
> Microsoft Visual Studio 2005.
>
> So, now i've found out, how to get data from a table. doing the
> following:
>
> [code]
> string sql = "SELECT * from transactions";
> OracleCommand cmd = new OracleCommand(sql, oracleConnection);
> cmd.CommandType = CommandType.Text;
> dataAdapter = new OracleDataAdapter(cmd);
>
> DataSet dataSet = new DataSet();
> dataAdapter.Fill(dataSet);
>
> DataGridView grdTransactions.DataSource = dataSet.Tables[0];
> [/code]
>
> this seems to be a quite convenient way to get a representation of the
> table (into a DataSet). And with a simple dataAdapter.Update(dataSet);
> command I can also get new rows that were added to the table in the
> dataSet to be stored in the Oracle database.
>
> My questions now are the following:
>
> 1. How can I get only the representation of a table into the local
> dataSet? (without fetching all the existing rows from the DB. after
> all, I sometimes only want to store one row into the database. that's
> it)
>
> 2. How can I create a Table programatically or execute any sql command
> (e.g. DROP, CREATE, INSERT INTO) on the database? (so far I've only
> found ways to execute a read/SELECT command for example with
> dataAdapter.Fill(dataSet); or command.ExecuterReader(); )
>
> 3. Isn't it possible to just work with a object-based abstraction of
> the database schema such as the DataSet class using that to add,
> alter, delete tables and then send the dataSet to the database to be
> stored exactly as it is?!?
>
> as far as possible I want to keep away from SQL commands and rather
> just use classes instead!
>
> Thanks in advance.
>
Received on Mon Mar 19 2007 - 17:14:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US