Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 May 10th, 2005, 11:27 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

Fist of all why are you using odbc, can't you use Oracle oledb provider.
This error might be bcoz you may have to pass some dummy value to the youroutvalue as it is of type inputoutput.

Prashant

 
Old May 11th, 2005, 02:04 AM
Registered User
 
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kalyansarkar108
Default

hi prashant,
thank you very much. the entire program is now running successfully..

and passing that dummy value worked. it was silly enough for me to ignore that it was an IN OUT parameter.

thank you once again.

hope you would help me in future too.

thanks and regards,
kalyan sarkar
 
Old March 26th, 2007, 04:27 AM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mr. Prasanth,

This is Balu. Very nice meeting you...

As per the below discussions you and Mr.Kalyan, you had suggested that "Oracle Function" has to change as "Oracle Procedure with OUT parameter".

Can't we call Oracle Function directly from VB without converting as procedure? I have this requirement in my project. Please do needful in this regards?

 
Old April 3rd, 2007, 11:58 AM
Authorized User
 
Join Date: Mar 2006
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Raghunathan
Default

hi,
if u want to call a ORACLE FUNCTION IN VB USING ADO
follow this..

Dim CmdFun as NEW ADODB.COMMAND
Dim Param_Given_Day As ADODB.PARAMETER
Dim Param_Centre As ADODB.PARAMETER
Dim Param_Return_Value As ADODB.PARAMETER
Dim Conn As NEW ADODB.CONNECTION


Conn.Open <give the connection string>
With CmdFun
    .ActiveConnection = Conn
    .CommandType = adCmdStoredProc
    .CommandText = "ValidWorkingDay" 'Name of the ORACLE Function, in String
    .CommandTimeOut = 10
End With

Set Param_Given_Day = New ADODB.PARAMETER
Set Param_Centre = New ADODB.PARAMETER
Set Param_Return_Value = New ADODB.PARAMETER

With Param_Given_Day
    .Direction = adParamInput
    .Value = "give the input value for the parameter, here"
End With

With Param_Centre

CREATE OR REPLACE function
ValidWorkingDay(given_day date,centre varchar2)
return boolean

Regards,
Raghu
 
Old April 3rd, 2007, 12:02 PM
Authorized User
 
Join Date: Mar 2006
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Raghunathan
Default

.....
Continuation from the above reply (sorry i accidentally pressed the submit button while posting the answer)....

With Param_Centre
     .Direction = adParamInput
    .Value = "give the input value for the parameter, here"
End With

With Param_Return_Value
    .Direction = adParamReturnValue
End With

'First append the return value parameter to the command object's parameters 'collection and then append the rest of the parameter objects in order

CmdFun.Parameters.Append Param_Return_Value
CmdFun.Parameters.Append Param_Given_Day
CmdFun.Parameters.Append Param_Centre

CmdFun.Execute 'Executing the function using the command object

'Getting the Return Value of the Function From the Parameter Object
MsgBox "Return value is : " & Param_Return_Value.value


Hope this would help u solve ur problem.. pls set the type and size property for all the parameter objects as required by the oracle function.

any queries mail or post

ALL THE BEST FRIEND



Regards,
Raghu





Similar Threads
Thread Thread Starter Forum Replies Last Post
calling c# webservice from VB6 GS Pro VB 6 2 February 26th, 2016 09:28 AM
call oracle function using oracle link server vl SQL Server 2000 1 July 12th, 2007 08:19 AM
Calling Oracle function from Vb.net class monuindia2002 ADO.NET 1 August 4th, 2006 05:00 AM
Calling oracle packages from VB RGC Pro VB Databases 1 June 18th, 2004 02:16 AM
Calling WebService from VB6 without use SOAP toolk sanjaykabra82 .NET Web Services 1 February 25th, 2004 08:30 AM





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