|
-
Nov 30th, 2012, 12:01 PM
#1
Thread Starter
New Member
ODBC Driver For Oracle That Executes Multiple Statements
I am writing a VB2010 app that reads a SQL command file that contains multiple SQL statements. I've tried multiple ODBC drivers but can't find one that executes multiple statements. Does anyone have any ideas? Am I going down the wrong path?
Sample Code:
' Define variables:
Dim dbORA As New OdbcConnection
Dim rsORA As New OdbcCommand("", dbORA)
Dim srORA As StreamReader
' Create connection string & open connection:
dbORA.ConnectionString = "Driver={Oracle in OraClient11g_home1};Dbq=dbname;Uid=username;Pwd=password;"
dbORA.Open()
' Create streamreader to read SQL statements and store statements in ODBC command variable:
srORA = New StreamReader("C:\statements.sql")
rsORA.CommandText = srORA.ReadToEnd
srORA.Close()
' Execute SQL statements:
rsORA.ExecuteNonQuery()
' Error message:
ERROR [HY000] [Oracle][ODBC][Ora]ORA-00922: missing or invalid option
The error message is misleading because the SQL statements are valid and can be run via SQL Developer or another Oracle utility
-
Nov 30th, 2012, 12:43 PM
#2
Re: ODBC Driver For Oracle That Executes Multiple Statements
It's nothing to do with the drivers. VB.Net doesn't do multiple SQL statements as a single command. You must set up an array or list of commands and execute them in turn.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 30th, 2012, 07:28 PM
#3
Thread Starter
New Member
Re: ODBC Driver For Oracle That Executes Multiple Statements
I can execute multiple SQL statements against SQL Server in one command statement. Is this a limitation of VB & Oracle?
-
Nov 30th, 2012, 07:38 PM
#4
Re: ODBC Driver For Oracle That Executes Multiple Statements
VB yes. Oracle probably not although I've never used it so I can't be definitive about that.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Tags for this Thread
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
|