943,871 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 4811
  • VB.NET RSS
Jun 16th, 2008
0

Using PL/SQL in VB.net

Expand Post »
Does anyone know a way in which I can execute PL/SQL statements in a VB.NET program? Any input is appreciated.

Thanks.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
EJK972 is offline Offline
2 posts
since Jun 2008
Jun 16th, 2008
0

Re: Using PL/SQL in VB.net

Click to Expand / Collapse  Quote originally posted by EJK972 ...
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.)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
safealloys is offline Offline
9 posts
since Jun 2008
Jun 16th, 2008
0

Re: Using PL/SQL in VB.net

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
EJK972 is offline Offline
2 posts
since Jun 2008
Jun 18th, 2008
0

Re: Using PL/SQL in VB.net

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...".
Reputation Points: 25
Solved Threads: 5
Newbie Poster
dadelsen is offline Offline
22 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: The process cannot access the file 'D:\pagefile.sys' because it is being used by anot
Next Thread in VB.NET Forum Timeline: Hire/remove lines from gridview





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC