Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

adding a dataset to Oracle database in C#

645940Jun 24 2008 — edited Jun 24 2008
Hello,
I am reading a dataset from .csv files and now I want to write this dataset to an oracle database. I want to create these datatables in the database and every time after that the tables should be only updated. I started with open the oracle connection but I am not sure how to proceed further. Any ideas?
Thanks

Code:

public void Write(DataSet ds, string[] names)
{
string conStr = "User d=***;Password=***;DataSource=***";
Console.WriteLine("Exporting to datatable {0} ...", names[0]);
OracleConnection oraConnection = new OracleConnection(conStr);

try
{
oraConnection.Open();

Console.WriteLine("\nHello, Oracle Here!\n");
Console.WriteLine("Connection String: ");
Console.WriteLine(oraConnection.ConnectionString.ToString() + "\n");
Console.WriteLine("Current Connection State: ");
Console.WriteLine(oraConnection.State.ToString() + "\n");
Console.WriteLine("Oracle Database Server Version: ");
Console.WriteLine(oraConnection.ServerVersion.ToString());
}
catch (Exception ex)
{
Console.WriteLine("Error occured: " + ex.Message);
}

// create the command object
OracleCommand command = new OracleCommand(conStr);



foreach (DataTable table in ds.Tables)
{
.........
.........
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2008
Added on Jun 24 2008
1 comment
507 views