First of I have Oracle 10g, VB.Net 2008 and Im using the lated download of ODP.Net I found on the main website.
I have the following SQL code,
begin execute immediate 'drop table DEPT';
execute immediate 'drop table EMP';
exception when others then null;
end;
Which I have already tested in Oracle and it works in Oracle, but I cant seem to get this to run in VB.Net. The Connection is up and running, and I can create tables in my database no problem using a another part, similiar of the program so i know thats not whats wrong
Below is the Code in VB.Net Im using
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim MyPath As String = Application.StartupPath
Dim File1 As String = MyPath & "/SQL Files/RemoveSchema.sql"
modConnection.connection.Open()
modConnection.ExecuteSQLProcedure(File1, modConnection.connection)
Catch ex As Exception
MsgBox(ex.Message)
Finally
modConnection.connection.Close()
Me.Close()
End Try
End Sub
Module modConnection
Sub ExecuteSQLProcedure(ByVal Filename As String, ByVal conn As OracleConnection)
Dim cmd As New OracleCommand
Dim Reader As System.IO.StreamReader
Try
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = conn
Reader = New System.IO.StreamReader(Filename)
Dim SQL As String = Reader.ReadToEnd
cmd.CommandText = SQL
cmd.ExecuteNonQuery()
Reader.Close()
Reader.Dispose()
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
End Try
End Sub
End Module
So when a button is clicked it loads a file, which has the above sql code in it, and runs the statement, but I am getting the following error
ORA-06550: Line 1, Column 50:
PLS-00103: Encountered the symbol "" When expecting the following:
Begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier><a double-quoted delimited-identifier>
<a bind variable> << close current delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
pipe
The symbol "begin was inserted before "" to continue.
ORA-06550: Line 2, Column 37:
PLS-00103: Encountered the symbol "" When expecting the following:
Begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier><a double-quoted delimited-id
ORA-06550: Line 3, Column 33:
PLS-00103: Encountered the symbol "" When expecting the following:
Begin case declare end exit for goto if loop mod null pragma
raise return select update when while with <an identifier>
<a double-quoted delimited-identif
*That is thrown by the application*
*Any help getting this working would be extremely appreciated*
Edited by: user8939472 on Dec 31, 2009 6:48 AM