C# -Oracle- Access
-
hi.. I m new to Oracle and c#.still I am tryiyng to picking up stones here :) currently I am working on Script Task tool in SSIS (Using c#) in which I need to store the resultset from my Oracle stored procedure in to a MS access table.Below is the code:
public void Main()
{
OracleConnection conn = new OracleConnection();
// TODO: Add your code here
conn.ConnectionString= "UserId=XXXX;Password=XXXX;Data Source= "XXXXXXX;";conn.Open(); //execute stored procedure here DataTable resultDT = new DataTable(); OracleCommand Cmd = new OracleCommand(); Cmd.Connection = conn; Cmd.CommandText = "My\_StoreProc"; Cmd.CommandType = CommandType.StoredProcedure; OracleParameter\[\] paramsArray = new OracleParameter\[2\]; paramsArray\[0\] = new OracleParameter("fromDate", OracleDbType.Date, ParameterDirection.Input); paramsArray\[1\] = new OracleParameter("toDate", OracleDbType.Date, ParameterDirection.Input);
..and here after I am stucked how to proceed with ..:-( how to use Oracle dataadapter,dataset and store this result set in an Access table?Any help will be appreciated! Thanks in advance! BigFish
-
hi.. I m new to Oracle and c#.still I am tryiyng to picking up stones here :) currently I am working on Script Task tool in SSIS (Using c#) in which I need to store the resultset from my Oracle stored procedure in to a MS access table.Below is the code:
public void Main()
{
OracleConnection conn = new OracleConnection();
// TODO: Add your code here
conn.ConnectionString= "UserId=XXXX;Password=XXXX;Data Source= "XXXXXXX;";conn.Open(); //execute stored procedure here DataTable resultDT = new DataTable(); OracleCommand Cmd = new OracleCommand(); Cmd.Connection = conn; Cmd.CommandText = "My\_StoreProc"; Cmd.CommandType = CommandType.StoredProcedure; OracleParameter\[\] paramsArray = new OracleParameter\[2\]; paramsArray\[0\] = new OracleParameter("fromDate", OracleDbType.Date, ParameterDirection.Input); paramsArray\[1\] = new OracleParameter("toDate", OracleDbType.Date, ParameterDirection.Input);
..and here after I am stucked how to proceed with ..:-( how to use Oracle dataadapter,dataset and store this result set in an Access table?Any help will be appreciated! Thanks in advance! BigFish
You shouldn't use the .NET oracle data provider, because the libraries are deprecated. A cite:
Quote:
The types in System.Data.OracleClient are deprecated. The types are supported in version 4 of the .NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider.
Source: Oracle and ADO.NET[^]
-
You shouldn't use the .NET oracle data provider, because the libraries are deprecated. A cite:
Quote:
The types in System.Data.OracleClient are deprecated. The types are supported in version 4 of the .NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider.
Source: Oracle and ADO.NET[^]
-
Hi there. I am using .NET Oracle.DataAccess.dll.. I m pretty sure that it can be done.Can anyone lead me till the dataset fill? Regards, BF
What Rex said is that while it works now it will not work in the future, change your data provider before going any further. I would extract the data into a table/list via the data connection, create another connection to the Access database and write the table/list to the destination table in Access.
Never underestimate the power of human stupidity RAH
-
hi.. I m new to Oracle and c#.still I am tryiyng to picking up stones here :) currently I am working on Script Task tool in SSIS (Using c#) in which I need to store the resultset from my Oracle stored procedure in to a MS access table.Below is the code:
public void Main()
{
OracleConnection conn = new OracleConnection();
// TODO: Add your code here
conn.ConnectionString= "UserId=XXXX;Password=XXXX;Data Source= "XXXXXXX;";conn.Open(); //execute stored procedure here DataTable resultDT = new DataTable(); OracleCommand Cmd = new OracleCommand(); Cmd.Connection = conn; Cmd.CommandText = "My\_StoreProc"; Cmd.CommandType = CommandType.StoredProcedure; OracleParameter\[\] paramsArray = new OracleParameter\[2\]; paramsArray\[0\] = new OracleParameter("fromDate", OracleDbType.Date, ParameterDirection.Input); paramsArray\[1\] = new OracleParameter("toDate", OracleDbType.Date, ParameterDirection.Input);
..and here after I am stucked how to proceed with ..:-( how to use Oracle dataadapter,dataset and store this result set in an Access table?Any help will be appreciated! Thanks in advance! BigFish
1. Write code that ONLY gets data from Oracle. If the result set is large then create a streaming idiom. You extract the results into a data structure written in C#. 2. Test it. 3. Write code that ONLY puts data into Access. You use the above data structure. 4. Test that. 5. Put 1 and 3 together.