i want to access the cells of excel sheet in .NET c# as we do in case of oracle database. is there any code to convert xl data to oracle.please reply as early as possible.
Loading
i want to access the cells of excel sheet in .NET c# as we do in case of oracle database. is there any code to convert xl data to oracle.please reply as early as possible.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bechir BejaouiPosted May 4, 2009, 6:37 AM
Not at all you're welcome ; )
Bechir BejaouiPosted May 4, 2009, 6:37 AM
Not at all you're welcome ; )
Bechir BejaouiPosted May 4, 2009, 6:37 AM
Not at all you're welcome ; )
shruti balapgolPosted Apr 6, 2009, 7:20 AM
thankyou so much
this code has solved my problem
string
connectionString1 = "Dsn=scott;uid=system;pwd=query";System.Data.Odbc.
OdbcConnection con = new System.Data.Odbc.OdbcConnection(connectionString1);System.Data.
DataSet dsOracle = new System.Data.DataSet(); string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + "C:\\TBL_STUD_EMP_REC.xls" + ";" + "Extended Properties='Excel" + " 8.0;HDR=NO;IMEX=1;'"; string CommandText = "select * from [sheet1$]"; OleDbConnection myConnection = new OleDbConnection(ConnectionString); OleDbCommand myCommand = new OleDbCommand(CommandText, myConnection);myConnection.Open();
OleDbDataReader reader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()){
System.
Console.WriteLine(reader[0].ToString()); string query = "INSERT INTO SCOTT.TBLSTUDEMPREC values('" + reader[0].ToString() + "','" + reader[1].ToString() + "','" + reader[2].ToString() + "')"; //'" + reader[3].ToString() + "')"; //values(2,'rini','pune')";con.Open();
System.Data.Odbc.
OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(query, con);System.Data.Odbc.
OdbcDataAdapter adpt = new System.Data.Odbc.OdbcDataAdapter(cmd);adpt.Fill(dsOracle);
con.Close();
}
Bechir BejaouiPosted Apr 3, 2009, 6:18 AM
shruti balapgolPosted Mar 22, 2009, 9:14 AM
Vijaya KadiyalaPosted Mar 21, 2009, 12:48 PM
Hi
You want to read the data from excel or insert the data into Oracle?
Thanks -- Vijaya Kadiyala
http://dotnetvj.blogspot.com
Bechir BejaouiPosted Mar 20, 2009, 6:44 AM
You want to access an Excel file
or
Transfer data from excel to oracle by using insert into SQL request
Sateesh ArvetiPosted Mar 20, 2009, 5:14 AM
You can use either Excel Interop library or oledb provider to read excel data.After reading the data into a datareader,loop through it and insert into oracle table as shown below:
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\spreadsheet.xls; Extended Properties=""Excel 8.0;";
string CommandText = "select * from [sheetName]";
OleDbConnection myConnection = new OleDbConnection(ConnectionString);
OleDbCommand myCommand = new OleDbCommand(CommandText, myConnection);
myConnection.Open();
OleDbDataReader reader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read())
{
//name =reader[0].ToString();
//Oracle Insert stmt here with values got from reader object.
}