#Region " ' OO4O Connect"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strSQL1 As String
Dim strSQL2 As String
Dim n As Integer
Dim j As Integer
Dim countC As Integer
Dim countR As Integer
Dim obj As Object
Dim iora As OracleInProcServer.OraField
Dim aoDataSet As DataSet
aoDataSet = New DataSet
Dim aoTable As DataTable
aoDataSet.Tables.Add("aoTable")
Dim ODyn As OraDynaset
strSQL1 = "UPDATE T_MSG SET DELFLG = 0 WHERE MSGDISP = 1"
strSQL2 = "SELECT * FROM superwei "
Try
Dim blnConnect As Boolean = OO4O_Connection()
If blnConnect = False Then
Exit Sub
End If
aoDataBase.BeginTrans() ' Begin Transaction
'n = aoDataBase.ExecuteSQL(strSQL1) ' normal SQL run
ODyn = aoDataBase.CreateDynaset(strSQL2, ORADYN_READONLY) ' return OraDynaset
If ODyn.BOF Or ODyn.EOF Then
MsgBox("Empty")
Exit Sub
Else
ODyn.MoveFirst()
End If
aoDataSet = collectionChange(ODyn)
'DataGrid1.DataSource = aoDataSet.Tables(0)
Call disData(DataGrid1, aoDataSet)
aoDataBase.Rollback()
Catch ex As Exception
MsgBox(Me.Text & ":" & ex.Message)
TextBox1.Text = Me.Text & ":" & ex.Message
aoDataBase.Rollback()
End Try
End Sub
Function disData(ByVal Dgd As DataGrid, ByVal aoDataSet As DataSet)
Dgd = Me.DataGrid1
Dgd.DataSource = aoDataSet.Tables(0)
End Function
#End Region
Module OO4O_Connect
Public aoDataBase As OracleInProcServer.OraDatabase
Public Overloads Function OO4O_Connection() As Boolean
Dim oOraSession As OracleInProcServer.OraSession
Try
Dim oOraDataBase As Object
Dim sConnectString As String
Dim asHostName As String = "ips"
sConnectString = "ips/ips"
oOraSession = CreateObject("OracleInProcServer.XOraSession")
aoDataBase = oOraSession.OpenDatabase(asHostName, sConnectString, 0)
OO4O_Connection = True
Catch ex As Exception
MsgBox(ex.Message & " " & ex.ToString)
OO4O_Connection = False
End Try
End Function
Public Overloads Function OO4O_Connection(ByVal _aoDataBase As OracleInProcServer.OraDatabase) As OracleInProcServer.OraDatabase
Dim oOraSession As OracleInProcServer.OraSession
Try
Dim oOraDataBase As Object
Dim sConnectString As String
Dim asHostName As String = "ips"
sConnectString = "cho_objown/cho_objown"
oOraSession = CreateObject("OracleInProcServer.XOraSession")
_aoDataBase = oOraSession.OpenDatabase(asHostName, sConnectString, 0)
Return _aoDataBase
Catch ex As Exception
MsgBox(ex.Message & " " & ex.ToString)
'OO4O_Connection = False
End Try
End Function
End Module