Re: Calling stored procedures from Visual Basic for appl?
From: Ian Hariott <ihariott_at_caritas.ab.ca>
Date: 8 Feb 1995 19:26:05 GMT
Message-ID: <3hb5sd$b6h_at_gnho.caritas.ab.ca>
Date: 8 Feb 1995 19:26:05 GMT
Message-ID: <3hb5sd$b6h_at_gnho.caritas.ab.ca>
In article <3gumv3$a0m_at_gsusgi1.gsu.edu>, matsisx_at_gsusgi1.gsu.edu says...
>
>
>Does anybody know how to call Oracle stored procedures using Visual Basic
>for Applications and while doing so, is it also possible to to pass
>parameters and receive back values.
>
>Any info in this will be very helpful.
>
>Thanks,
>
>Sagar
>--
>This is the end.
--
Ian Hariott ihariott_at_caritas.ab.ca
If Visual Basic supports ODBC, you should be able to execute
stored procedures. However, you first have to install the ORACLE7 ODBC
driver. You can pass parameters, but to the best of my knowlegde, you can't
receive back values. I have used Visual
C++ to call ORACLE7 stored procedures, and it worked well.
Here is a quick example using Visual C++
extern HENV henv; // ODBC environment variable
extern HDBC hdbc; // ODBC environment variable
HSTMT hstmtb; // SQL statement handle
UCHAR ustmt[30] = "{call ACCOUNT_CALC(?)}"; // stored procedure to be
executed ? - indicates that procedure is expecting an argument.
UCHAR type[4] = " FAD"; // static parameter, could also be a dynamic value
rc = SQLAllocStmt(hdbc,&hstmtb); //ODBC routines
rc = SQLSetParam(hstmtb,1,SQL_C_CHAR,SQL_CHAR,4,0,type,NULL);
rc = SQLPrepare(hstmtb,ustmt,SQL_NTS);
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
rc = SQLExecDirect(hstmtb,ustmt,SQL_NTS);
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
rc = SQLCancel(hstmtb);
}
This is how an ORACLE7 stored procedure is execute using Visual C++
peace
Received on Wed Feb 08 1995 - 20:26:05 CET
