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:
Expand|Select|Wrap|Line Numbers
- 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];
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.