Using PL/SQL in VB.net

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 2
Reputation: EJK972 is an unknown quantity at this point 
Solved Threads: 0
EJK972 EJK972 is offline Offline
Newbie Poster

Using PL/SQL in VB.net

 
0
  #1
Jun 16th, 2008
Does anyone know a way in which I can execute PL/SQL statements in a VB.NET program? Any input is appreciated.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 9
Reputation: safealloys is an unknown quantity at this point 
Solved Threads: 0
safealloys safealloys is offline Offline
Newbie Poster

Re: Using PL/SQL in VB.net

 
0
  #2
Jun 16th, 2008
Originally Posted by EJK972 View Post
Does anyone know a way in which I can execute PL/SQL statements in a VB.NET program? Any input is appreciated.

Thanks.
What have you done so far? (If you mean Presentation Layer in VB to communicate with SQL.)
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: EJK972 is an unknown quantity at this point 
Solved Threads: 0
EJK972 EJK972 is offline Offline
Newbie Poster

Re: Using PL/SQL in VB.net

 
0
  #3
Jun 16th, 2008
I am trying to read an SQL file from an external source on my harddrive. The SQL file is written in pl/sql so when I try to execute it in vb.net I receive a lot of errors (for example it won't register REM as a proper comment command).

So far I have tried various imports with no luck.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 22
Reputation: dadelsen is an unknown quantity at this point 
Solved Threads: 5
dadelsen dadelsen is offline Offline
Newbie Poster

Re: Using PL/SQL in VB.net

 
0
  #4
Jun 18th, 2008
Could it be that the file does not only contain PL/SQL? Comments in PL/SQL are
/* comment
comment  */
or
-- comment
Calling PL/SQL from VB .NET may basically be performed by executing the PL/SQL text like:

     Dim sSQL As String
        Try
            'create and use a function
            sSQL = "CREATE OR REPLACE FUNCTION MyMultiply( " & vbLf & _
                  "ifactor1 IN NUMBER, " & vbLf & _
                  "ifactor2 IN NUMBER " & vbLf & _
                  ") RETURN NUMBER IS" & vbLf & _
                  "  iResult NUMBER;" & vbLf & _
                  "BEGIN" & vbLf & _
                  "  iResult:=iFactor1*iFactor2;" & vbLf & _
                  "  RETURN iResult;" & vbLf & _
                  "END;"
            Dim aCmd As New OracleCommand(sSQL, OracleConnection1)
            aCmd.CommandType = CommandType.Text
            OracleConnection1.Open()
            aCmd.ExecuteNonQuery()
            '
            aCmd.CommandText = "SELECT MyMultiply(5, 7) FROM dual"
            MessageBox.Show(aCmd.ExecuteScalar().ToString)

        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        Finally
            OracleConnection1.Close()
        End Try

but there are traps for example using multiple PL/SQL statements in one call to "Execute...".
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC