Yup,
Just did this out yesterday!
DATABASE CLASS
Imports System
Imports System.Data
Imports System.Data.OracleClient
Public Class clsDatabase
Private _connection As OracleConnection
Private _connection_string As String
Private _SQL As String
Private _error As String
Public Property ConnectionString() As String
Get
Return _connection_string
End Get
Set(ByVal value As String)
_connection_string = value
End Set
End Property
Public Property strError() As String
Get
Return _error
End Get
Set(ByVal value As String)
_error = value
End Set
End Property
Public Property strSQL() As String
Get
Return _SQL
End Get
Set(ByVal value As String)
_SQL = value
End Set
End Property
Public Property objConnection() As Object
Get
Return _connection
End Get
Set(ByVal value As Object)
_connection = value
End Set
End Property
Public Function createConnection()
_connection = New OracleConnection(_connection_string)
' _connection = New OdbcConnection(_connection_string)
End Function
Public Function closeConnection()
_connection.Close()
_connection = Nothing
End Function
Public Function addUnallocatedIDs(ByRef arrUnallocated As ArrayList, ByVal
intID As Integer, ByVal boolAtStart As Boolean)
If boolAtStart Then
arrUnallocated.Insert(0, intID)
Else
arrUnallocated.Add(intID)
End If
End Function
Public Function removeUnallocatedIDs(ByRef arrUnallocated, ByVal intID)
arrUnallocated.Remove(intID)
End Function
End Class
/DATABASE CLASS
CALLING PACKAGE
Public Class clsCallPackage : Inherits clsDatabase
Private Function boolClearTable(ByVal strIdsConnectionString As String,
ByVal objTerminal As clsTerminal, ByVal strTable As String) As Boolean
Dim boolReturn As Boolean
Dim objCommand As OracleCommand
Dim strPackage As String
boolReturn = True
strPackage = getPackageName(strTable) & ".PRC_DELETE"
objCommand = New OracleCommand(strPackage, objConnection)
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Parameters.Add(New OracleParameter("IN_TERMINAL_ID",
OracleType.Int32)).Direction = ParameterDirection.Input
objCommand.Parameters("IN_TERMINAL_ID").Value = objTerminal.TerminalID
objCommand.Parameters.Add(New OracleParameter("IN_DELETE_ALL",
OracleType.Int32)).Direction = ParameterDirection.Input
objCommand.Parameters("IN_DELETE_ALL").Value = 1
objCommand.Parameters.Add(New OracleParameter("out_errMsg",
OracleType.VarChar)).Direction = ParameterDirection.Output
objCommand.Parameters("out_errMsg").Size = 50
Try
objConnection.Open()
boolReturn = objCommand.ExecuteNonQuery
objConnection.close()
Catch e As Exception
boolReturn = False
strError = CStr(e.ToString()) & " " &
CStr(objCommand.Parameters("out_errMsg").Value)
End Try
Return boolReturn
End Function
/CALLING PACKAGE
Obviously, this is specific to what I was doing, but I'm sure you'll find it
easy to tailor it to your needs.
regards,
Bruce