0% found this document useful (0 votes)
8 views1 page

Oracle Database Interaction in VB.NET

This code defines a class that connects to an Oracle database and retrieves and inserts data. It establishes a connection to an Oracle database using the connection string. It has two button click events, one that retrieves data from a table using a data adapter and fills a dataset, looping through the rows to populate textboxes. The other uses a data adapter to insert a new row with values from textboxes into a table. Any exceptions are caught and displayed in a message box.

Uploaded by

sivanadi009
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Oracle Database Interaction in VB.NET

This code defines a class that connects to an Oracle database and retrieves and inserts data. It establishes a connection to an Oracle database using the connection string. It has two button click events, one that retrieves data from a table using a data adapter and fills a dataset, looping through the rows to populate textboxes. The other uses a data adapter to insert a new row with values from textboxes into a table. Any exceptions are caught and displayed in a message box.

Uploaded by

sivanadi009
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Imports System.

Data
Imports [Link]

Public Class Form1


Public con As OracleConnection

Private Sub Form1_Load(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
con = New OracleConnection("DATA SOURCE=orcl;USER
ID=system;PASSWORD=happy")
End Sub

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Try
Dim da As OracleDataAdapter
Dim ds As DataSet = New DataSet
Dim dt As DataTable
Dim dr As DataRow
da = New OracleDataAdapter("select * from bhaodb", con)
Dim cm As New OracleCommandBuilder(da)
[Link](ds, "bhaodb")
dt = [Link](0)
For Each dr In [Link]
[Link] = [Link](0)
[Link] = [Link](1)
Next
Catch ex As Exception
MsgBox([Link])
End Try
End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Try
Dim da As OracleDataAdapter
Dim ds As DataSet = New DataSet
Dim dt As DataTable
Dim dr As DataRow
da = New OracleDataAdapter("select * from bhaodb", con)
Dim cm As New Oraclecommandbuilder(da)
[Link](ds, "bhaodb")
dt = [Link](0)
dr = [Link]
[Link](0) = [Link]
[Link](1) = [Link]
[Link](dr)
[Link](ds, "bhaodb")
Catch ex As Exception
MsgBox([Link])
End Try
End Sub
End Class

You might also like