255 pts.
 How to store Form values in Oracle 10g with VB.NET
abt database storage in vb.net2005

Software/Hardware used:
ASKED: March 11, 2009  10:24 AM
UPDATED: March 18, 2009  3:29 PM

Answer Wiki:
Have a look at the following Oracle article for the basics on connecting to the database from .NET It shows how to connect to the database and retrieve records using SELECT statements. To perform inserts and updates you just need to change de command text with the appropriate SQL command, and execute it as non reader (i.e. replacing cmd.ExecuteReader with cmd.ExecuteNonReader). <a href="http://www.oracle.com/technology/pub/articles/cook-vs08.html">Build a .NET Application on the Oracle Database with Visual Studio 2005 or 2008</a>
Last Wiki Answer Submitted:  March 11, 2009  2:00 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thanks Carlosdl for giving me the answer ,i will work out with this

 255 pts.

 

Imports Oracle.DataAccess.Client

Dim oradb As String = “Data Source=localhost;User Id=shazia;Password=shazia;”

Dim oradb As String = “Data Source=(DESCRIPTION=” _
+ “(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))” _
+ “(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));” _
+ “User Id=shazia;Password=shazia;”
Dim conn As New OracleConnection(oradb)
Dim conn As New OracleConnection() ‘ Visual Basic
conn.ConnectionString = oradb
conn.Open()
MsgBox(“connected successfully”)

iam getting errors such as
Error 1 Statement is not valid in a namespace. C:Documents and SettingsShazia (Delonti)My DocumentsVisual Studio 2005ProjectsschoolschoolAdd Admission.vb 4 1 school
plz give me a solution for this .iam new vb.net
Thanks once again

 255 pts.

 

In .NET, everything have to be inside a class or module (excluding the imports).

Also, there are some unnecessary lines in your code, for example the lines where you set the connection string.

If you want to avoid the use of the TNSNAMES.ORA file then use your second option:

Dim oradb As String = “Data Source=(DESCRIPTION=” _
+ “(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))” _
+ “(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));” _
+ “User Id=shazia;Password=shazia;”

Otherwise, use this (but replace ‘localhost’ with the database alias defined in your tnsnames.ora file):
Dim oradb As String = “Data Source=your_database_alias;User Id=shazia;Password=shazia;”

Your code should look similar to this:

Imports Oracle.DataAccess.Client

Public Class MainClass
Shared Sub Main()
Dim oradb As String = “Data Source=(DESCRIPTION=” _
+ “(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))” _
+ “(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));” _
+ “User Id=shazia;Password=shazia;”
Dim conn As New OracleConnection(oradb)
conn.Open()
End Sub
End Class

 63,535 pts.

 

Hi Carlosdl,

Thank u for helping me out .I have implemented the code which u have given .Now it is giving as error connection not open ora 6413.Plz give solution for that

Thanks & Regards,
shazia.

 255 pts.

 

I posted an answer here:

Solution for ORA-6413 error showing connection not open

See if it helps.

 63,535 pts.