.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Forum >> .NET Framework >> Post New QuestionBookmark and Share Subscribe to Forum

Oracle Database connection Program in Vb.Net

Posted By: Sushil     Posted Date: February 09, 2010    Points:2   Category :.NET Framework
I want sample ADD,UPDATE,DELETE,SEARCH Record Program in Vb.Net with
BackEnd -Oracle 10g
what is the Server name for Oracle Coonection Strig?
Plz Help Me.

Author: Sagar Pardeshi             
Posted Date: February 09, 2010     Points: 5   

Follow the steps:
Importing the Namespaces
Imports System
Imports Oracle.DataAccess.Client

###Step 1 The first step is to create an OracleConnection object to connect to the Oracle database and then open the connection.

Dim myOracleConnection As New OracleConnection( _
"User Id=store;Password=store;Data Source=ORCL")

###Step2 The second step is to create an OracleTransaction object and start the transaction by calling the BeginTransaction() method of the OracleConnection object.

Dim myOracleTransaction As OracleTransaction = _

###Step3 The third step is to create an OracleCommand object to store a SQL statement.

Dim myOracleCommand As OracleCommand =

###Step 4 The fourth step is to set the CommandText property of the OracleCommand object to the DELETE statement that deletes a row from the table.

myOracleCommand.CommandText = _
"delete from table where id = ' " & txtID.txt & "'"

Step 5

The fifth step is to run the DELETE statement using the ExecuteNonQuery() method of the OracleCommand object.

Dim Delete = MessageBox.Show("Are You Sure to Delete", "Query", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If (Delete = vbYes) Then
MessageBox.Show("Record Deleted successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

Step 6

The eighth step is to commit the transaction in the database using the Commit() method of the OracleTransaction object.


Step 7

The ninth step is to close the OracleConnection object using the Close() method.


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend