Hi,
Yes,
Change your declaration of the data access variables to the oracle flavour.
Following snippet shows using a compiler directive to control which database
this routine is looking at.
Oracle have OMWB (Oracle migration workbench) which will do a passable job
of converting an SQL Server database to an Oracle one.
The caveat being that you will have to massage the stored procedures to get
them to work.
If you go this way then suggest a copy of TOAD as it takes away the pain
when working with Oracle schemas.
Note: that you need a a cursor output parameter to get data back with an
Oracle SPROC. ( You'll see this below)
HTH
Bob
#If Not Oracle Then
Dim cmdConn As New SqlClient.SqlCommand
Dim cmdSource As SqlClient.SqlDataReader
Try
cmdConn = New SqlClient.SqlCommand(strSQL, New
SqlClient.SqlConnection(mstrConn))
strSQL = "exec proc_GetContact @contact_id"
cmdConn.Parameters.Add(New SqlParameter("@contact_id", SqlDbType.Int))
cmdConn.Parameters("@contact_id").Value = intContactID
cmdConn.CommandText = strSQL
cmdConn.Connection.Open()
cmdSource = cmdConn.ExecuteReader(CommandBehavior.CloseConnection)
'End If
If cmdSource.Read Then
C.ID = cmdSource.GetSqlInt32(0).Value
If Not cmdSource.GetSqlString(1).IsNull Then C.Firstname =
cmdSource.GetSqlString(1).Value
If Not cmdSource.GetSqlString(2).IsNull Then C.Surname =
cmdSource.GetSqlString(2).Value
If Not cmdSource.GetSqlString(3).IsNull Then C.EmailAddress =
cmdSource.GetSqlString(3).Value
If Not cmdSource.GetSqlString(4).IsNull Then C.SMSAddress =
cmdSource.GetSqlString(4).Value
If Not cmdSource.GetSqlString(5).IsNull Then C.Phone =
cmdSource.GetSqlString(5).Value
If Not cmdSource.GetSqlString(6).IsNull Then C.FAX =
cmdSource.GetSqlString(6).Value
Return True
End If
Catch obja As System.Exception
WriteErrorLog("DT.GetContactList Error " & obja.Message)
Finally
cmdSource.Close()
cmdConn.Dispose()
End Try
#Else
Dim cmdConn As OracleClient.OracleCommand
Dim cmdSource As OracleClient.OracleDataReader
Try
strSQL = "proc_GetContact"
cmdConn = New OracleClient.OracleCommand(strSQL, New
OracleClient.OracleConnection(mstrConn))
cmdConn.Parameters.Add(New OracleParameter("contact_id", OracleType.Number,
0, ParameterDirection.Input, _
True, 0, 0, "", DataRowVersion.Default, mydbNull))
cmdConn.Parameters.Add(New OracleClient.OracleParameter("o_cursor",
OracleClient.OracleType.Cursor, _
2000, ParameterDirection.Output, True, 0, 0, "", DataRowVersion.Default,
mydbNull))
cmdConn.CommandType = CommandType.StoredProcedure
cmdConn.Parameters("contact_id").Value = intContactID
cmdConn.Connection.Open()
cmdSource = cmdConn.ExecuteReader(CommandBehavior.CloseConnection)
'End If
If cmdSource.Read Then
C.ID = CInt(cmdSource.GetOracleNumber(0).Value)
If Not cmdSource.GetOracleString(1).IsNull Then C.Firstname =
cmdSource.GetOracleString(1).Value
If Not cmdSource.GetOracleString(2).IsNull Then C.Surname =
cmdSource.GetOracleString(2).Value
If Not cmdSource.GetOracleString(3).IsNull Then C.EmailAddress =
cmdSource.GetOracleString(3).Value
If Not cmdSource.GetOracleString(4).IsNull Then C.SMSAddress =
cmdSource.GetOracleString(4).Value
If Not cmdSource.GetOracleString(5).IsNull Then C.Phone =
cmdSource.GetOracleString(5).Value
If Not cmdSource.GetOracleString(6).IsNull Then C.FAX =
cmdSource.GetOracleString(6).Value
Return True
End If
Catch obja As System.Exception
WriteErrorLog("DT.GetContactList Error " & obja.Message)
Finally
cmdSource.Dispose()
If cmdConn.Connection.State <> ConnectionState.Closed Then
cmdConn.Connection.Close()
End If
cmdConn.Dispose()
End Try
#End If