Click here to Skip to main content
15,910,303 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have devolping an application in vb.net, oracle as backend for college project..
I want connect to access data from oracle and use it in vb.net.
Please help me..
kindly send some sample project or sample code that works 100%.
I am not too good in this.
So kindly say step by step procedure

What I have tried:

Dim oradb As String = "Data Source=orcl;User Id=hr;Password=hr;"
Dim conn As New OracleConnection(oradb)
conn.Open()
Dim cmd As New OracleCommand
cmd.Connection = conn
cmd.CommandText = "select department_name from departments where department_id = 10"
cmd.CommandType = CommandType.Text
Dim dr As OracleDataReader = cmd.ExecuteReader()
dr.Read()
Label1.Text = dr.Item("department_name")
conn.Dispose()

I tried this.. It does not show any error. but the data doesnot retrived
Posted
Comments
PIEBALDconsult 7-Feb-16 0:23am    
That looks OK; are you sure that the data exists?

 
Share this answer
 
Comments
Member 11090857 7-Feb-16 0:19am    
I read this article but i want more easier way. i cannot understand
For connection with the oracle first thing you need is the ODP(oracle data provider) download it and after that add reference to the following assembly
C#
Oracle.DataAccess.dll.
rest of your code seems to be ok.

For detailed explanation please check on the following link-->Connecting to Oracle Database through C#? - Stack Overflow[^]
 
Share this answer
 
v2
Comments
Member 11090857 12-Feb-16 23:38pm    
i also add this header..
Member 11090857 12-Feb-16 23:39pm    
In Data source what i want to give

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900