|
-
Apr 1st, 2006, 10:40 AM
#1
Thread Starter
Lively Member
Connection to Oracle in .Net Framework 1.0
Hi........
I've .Net Framework 1.0 and I want to connect Oracle 8i.
Can I do this in .Net Framework 1.0 ?
( System.Data.Odbc ) namespace does not exist in this version.
plz tell me how can I do it.......it would be more helpful if u post some code here.
Thanks,
Manoj
-
Apr 1st, 2006, 11:01 AM
#2
Thread Starter
Lively Member
Re: Connection to Oracle in .Net Framework 1.0
huh...
I resolved it and I'm posting my code here for reference.......
//Connection with Oracle.
OleDbConnection Conn = new OleDbConnection() ;
OleDbDataAdapter DA ;
DataTable DT ;
Conn.ConnectionString = @"Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=MANOJ" ;
Conn.Open() ;
DA = new OleDbDataAdapter("Select * From Emp", Conn ) ;
DT = new DataTable() ;
DA.Fill(DT) ;
dataGrid1.DataSource = DT ;
//Connection to MS Access.
OleDbConnection Conn ;
OleDbDataAdapter DA ;
DataTable DT ;
Conn = new OleDbConnection() ;
Conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Manoj\MyDatabase.mdb" ;
Conn.Open() ;
DA = new OleDbDataAdapter("Select * From EmpInfo", Conn ) ;
DT = new DataTable() ;
DA.Fill(DT) ;
dataGrid1.DataSource = DT ;
Thanks & Regards
Manoj
-
Apr 1st, 2006, 03:10 PM
#3
Re: Connection to Oracle in .Net Framework 1.0
Wht connect though ODBC it's more costly then using the direct method.
?
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Apr 1st, 2006, 06:08 PM
#4
Re: Connection to Oracle in .Net Framework 1.0
You can download ADO.NET components from Oracle, although it does not mention 8i. I'd download the 9i version and see if that works. The Oracle-specific components will be more efficient and possibly more functional than the more general OleDb.
-
Apr 5th, 2006, 09:48 AM
#5
New Member
Re: Connection to Oracle in .Net Framework 1.0
using System.Data.OracleClient;
(reference:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.OracleClient.dll
from Microsoft site, I believe)
If you don't have the reference, I will be glad to send it.
string Hdrstr = "SERVER=SERVERNAME;UId=MYUSERID;Pwd=thepassword";
OracleConnection HdrConn = new OracleConnection(Hdrstr);
HdrConn.Open();
OracleCommand HdrCmd = HdrConn.CreateCommand();
HdrCmd.CommandText = "SELECT H.RID, H.DATE " +
" FROM JOURNAL_ENTRY H " +
" WHERE H.DATE BETWEEN '" + txtFromDate.Text + "' and '" + txtToDate.Text +
"' ORDER BY H.DATE";
OracleDataReader HdrReader = HdrCmd.ExecuteReader();
The Oracle commands are essentially the same as the OleDb commands.
I am using this on Oracle 8i. It works fairly quickly considering the speed of the machine I'm using.
-
Apr 5th, 2006, 04:59 PM
#6
Re: Connection to Oracle in .Net Framework 1.0
That's not possible in version 1.0 of the Framework tablazon, as the System.Data.OracleClient namespace wasn't added until version 1.1.
-
Apr 6th, 2006, 03:50 PM
#7
New Member
Re: Connection to Oracle in .Net Framework 1.0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|