|
-
Jul 15th, 2004, 01:00 PM
#1
Thread Starter
Hyperactive Member
How to call Oracle stored proc from vb.net app?
I know it is different way to call Oracle stored procedure when compared to SQL server stored proc.
I am using currently the following format to call sql proc (BTW I am using Microsoft DATA access block )
"calling sqlserver stored proc"
helper = GetAdoHelper()
sConn = GetConnectionString()
drsql = helper.ExecuteReader(sConn, CommandType.StoredProcedure, "GetCustomers")
"How to call Oracle stored Proc"??
any help is greatly appreciated
-
Jul 15th, 2004, 01:16 PM
#2
Unfortunatly the MS Data Access block was designed specifically for SQL Server and uses the SQLData objects. To use Oracle, you will either need to use the OLEDB namespace, or see if there is an Oracle-specific .NET driver.
TG
-
Jul 15th, 2004, 04:13 PM
#3
Thread Starter
Hyperactive Member
connecting to oracle is also possible thru data access block
http://www.gotdotnet.com/Community/W...c-aaeb21d1f431
but, I don't know how to use it to use stored procs in oracle .
thanks
-
Jul 15th, 2004, 04:34 PM
#4
I wonder how many charact
Right-click on your Project... Add Reference...
(Make sure .Net is tab shown)
Browse to System.Data.OracleClient
Click OK
VB Code:
Dim OrcConnection1 As New System.Data.OracleClient.OracleConnection("yourconnectionstring")
Dim OrcCommand1 As New System.Data.OracleClient.OracleCommand
OrcCommand1.CommandType = CommandType.StoredProcedure
OrcCommand1.CommandText = "nameofyourprocedure"
OrcCommand1.Connection = OrcConnection1
Dim myreader As System.Data.OracleClient.OracleDataReader
myreader = OrcCommand1.ExecuteReader(CommandBehavior.CloseConnection)
While myreader.Read
'do whatever
End While
myreader.Close()
-
Jul 15th, 2004, 05:15 PM
#5
Thread Starter
Hyperactive Member
don't we have to something related to the parameters?
I guess your code works if we are calling sqlserver but not oracle.
nath
-
Jul 15th, 2004, 05:24 PM
#6
I wonder how many charact
It works fine... if you wanted a parameter, simply add it:
VB Code:
OrcCommand1.Parameters.Add(New OracleParameter("@fkReadTheHElp", System.Data.OracleClient.OracleType.Int32))
OrcCommand1.Parameters(0).Value = 1
Seriously, just Use the Help ... it has all the information you need...
Last edited by nemaroller; Jul 15th, 2004 at 05:38 PM.
-
Jul 16th, 2004, 11:44 AM
#7
Thread Starter
Hyperactive Member
thank you sir.
I will try .
regards
nath
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|