Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 18th, 2003, 06:01 PM
Registered User
 
Join Date: Dec 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Oracle in VB

Posted - 12/18/2003 : 2:26:24 PM
--------------------------------------------------------------------------------

Hi experts!
I'm new to VB and oracle stored procedure. I had created a
VB code to execute a stored procedure in Oracle,, and in the stored procedure, a link to another oracle database is created.
I created a stored procedure in Oracle database "A" and want to get some data information from oracle database "EVF16" which I don't have any right to create a store procedure or nothing...
Here is my VB code:
'I had something like database connection here...

Dim Cmd As New ADODB.Command
' Use a connection string or a Connection object.
Cmd.ActiveConnection = "Provider=MSDASQL;DSN=" & strDBNAME & ";UID=" & strID & ";PWD=" & strPW & ";DBQ=" & strDBNAME & ";ASY=OFF;"
Cmd.CommandText = "test2"
Cmd.CommandTimeout = 30
Cmd.CommandType = adCmdStoredProc
Cmd.Execute

and here's my stored procedure:
/* Declare string to store SQL Statement*/
v_sql varchar2(1000);

/* Declare string to store SQL Statement*/
v_sql varchar2(1000);

begin
delete from AV_project where proj in (Select proj from av_project@evf16 where proj='xxxx' );
v_sql := 'execute test2';
execute immediate v_sql;
end;

The error's something like : Oracle transaction is not open..or somethign like that...

Please help me..thanks

ANd even I've to add BeginTrans and CommitTrans but still not work.



 
Old December 22nd, 2003, 05:59 AM
Authorized User
 
Join Date: Jun 2003
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is the error coming from VB or Oracle?. Check the ADODB.Errors collection and see what's in there. The begintrans and committrans, need's to reside in the Stored procedure and Not VB.

You also need to have the correct access rights set in the DB for the user you are logging in as for the table.

If all the above are/or appear ok, then first of all remove the VB from the equation and first try and run the procedure from within Oracle itself. This will at least narrow where to concentrate your efforts (vb or Oracle).

Last but not least, ensure you have the correct Oracle Drivers installed on your PC (e.g. using Oracle 9, but have Oracle 8 drivers installed).






Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in write application using VB and Oracle b3kool VB Databases Basics 3 December 11th, 2006 03:17 PM
connect Oracle from VB davElbaz Oracle 6 December 17th, 2004 11:08 AM
Bulk Inserting from VB to Oracle parshavgarg Pro VB Databases 0 July 29th, 2004 07:18 AM
importing Excel into Oracle using VB hagit Oracle 0 January 21st, 2004 07:53 PM
Oracle and VB sagarkoirala VB How-To 0 August 8th, 2003 06:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.