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.SqlCo mmand
Dim cmdSource As SqlClient.SqlDa taReader
Try
cmdConn = New SqlClient.SqlCo mmand(strSQL, New
SqlClient.SqlCo nnection(mstrCo nn))
strSQL = "exec proc_GetContact @contact_id"
cmdConn.Paramet ers.Add(New SqlParameter("@ contact_id", SqlDbType.Int))
cmdConn.Paramet ers("@contact_i d").Value = intContactID
cmdConn.Command Text = strSQL
cmdConn.Connect ion.Open()
cmdSource = cmdConn.Execute Reader(CommandB ehavior.CloseCo nnection)
'End If
If cmdSource.Read Then
C.ID = cmdSource.GetSq lInt32(0).Value
If Not cmdSource.GetSq lString(1).IsNu ll Then C.Firstname =
cmdSource.GetSq lString(1).Valu e
If Not cmdSource.GetSq lString(2).IsNu ll Then C.Surname =
cmdSource.GetSq lString(2).Valu e
If Not cmdSource.GetSq lString(3).IsNu ll Then C.EmailAddress =
cmdSource.GetSq lString(3).Valu e
If Not cmdSource.GetSq lString(4).IsNu ll Then C.SMSAddress =
cmdSource.GetSq lString(4).Valu e
If Not cmdSource.GetSq lString(5).IsNu ll Then C.Phone =
cmdSource.GetSq lString(5).Valu e
If Not cmdSource.GetSq lString(6).IsNu ll Then C.FAX =
cmdSource.GetSq lString(6).Valu e
Return True
End If
Catch obja As System.Exceptio n
WriteErrorLog(" DT.GetContactLi st Error " & obja.Message)
Finally
cmdSource.Close ()
cmdConn.Dispose ()
End Try
#Else
Dim cmdConn As OracleClient.Or acleCommand
Dim cmdSource As OracleClient.Or acleDataReader
Try
strSQL = "proc_GetContac t"
cmdConn = New OracleClient.Or acleCommand(str SQL, New
OracleClient.Or acleConnection( mstrConn))
cmdConn.Paramet ers.Add(New OracleParameter ("contact_id ", OracleType.Numb er,
0, ParameterDirect ion.Input, _
True, 0, 0, "", DataRowVersion. Default, mydbNull))
cmdConn.Paramet ers.Add(New OracleClient.Or acleParameter(" o_cursor",
OracleClient.Or acleType.Cursor , _
2000, ParameterDirect ion.Output, True, 0, 0, "", DataRowVersion. Default,
mydbNull))
cmdConn.Command Type = CommandType.Sto redProcedure
cmdConn.Paramet ers("contact_id ").Value = intContactID
cmdConn.Connect ion.Open()
cmdSource = cmdConn.Execute Reader(CommandB ehavior.CloseCo nnection)
'End If
If cmdSource.Read Then
C.ID = CInt(cmdSource. GetOracleNumber (0).Value)
If Not cmdSource.GetOr acleString(1).I sNull Then C.Firstname =
cmdSource.GetOr acleString(1).V alue
If Not cmdSource.GetOr acleString(2).I sNull Then C.Surname =
cmdSource.GetOr acleString(2).V alue
If Not cmdSource.GetOr acleString(3).I sNull Then C.EmailAddress =
cmdSource.GetOr acleString(3).V alue
If Not cmdSource.GetOr acleString(4).I sNull Then C.SMSAddress =
cmdSource.GetOr acleString(4).V alue
If Not cmdSource.GetOr acleString(5).I sNull Then C.Phone =
cmdSource.GetOr acleString(5).V alue
If Not cmdSource.GetOr acleString(6).I sNull Then C.FAX =
cmdSource.GetOr acleString(6).V alue
Return True
End If
Catch obja As System.Exceptio n
WriteErrorLog(" DT.GetContactLi st Error " & obja.Message)
Finally
cmdSource.Dispo se()
If cmdConn.Connect ion.State <> ConnectionState .Closed Then
cmdConn.Connect ion.Close()
End If
cmdConn.Dispose ()
End Try
#End If
"Amueerie" <a_*******@msn. com> wrote in message
news:u%******** ********@TK2MSF TNGP10.phx.gbl. ..
this may seem a trivial question (as .net may have been solely developed
for this purpose),
but i'm not certain whether this is possible,
i.e. is it possible to access an Oracle DB in .NET (and is it the same as
accessing any other db - except for the connection string & object).
What is mean is, can i use the same select statements, update statements
with the orable database that i used with MSDE & SQL database?
thank u all