Help! VB 5.0 access Informmix database via SPC(Stored Procedure Call)
Posted in 1997
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Server Administration
Please give me a hint how to fetch informix database data using RDO (Remote
Data Control) and SPC (Stored Procedure Call). The source codes are written as
follows:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Dim strUID as string, strPWD as string
Dim strServer as string, strDatabase as string
Dim envTemp as rdoEnviroment
Dim conTemp as rdoconnection
Dim qryTemp as rdoQuery
Dim strSPC as string
dim rrsData as rdoResultset
strUID="informix"
strPWD="dba123"
strServer="tmserver"
strDatabase="nbstmdb"
Set envTemp=rdoEnginemonts(0)
With envTemp
envTemp.CursorDriver=rdUseOdbc
Set conTemp=envTemp.OpenConnection(dsname:="tmdb", _
Prompt:=rddriverNoPrompt, _
ReadOnly:=True, _
Connect:="UID=" & strUID & "; PWD=" _
strPWD & "; server=" & strServer & _
"; database=" & strDatabase & ";")
end With
strSPC="{ ? = call GetNewAppCnt}" & chr$(0)
Set qryTemp=conTemp.CreateQuery("GetNewAppCount", strSPC)
qryTemp.rdoParameters(0).Direction=rdoParaReturnValue **
Set rrsData=qryTemp.OpenResultset(rdOpenForwardOnly)
MsgBox str$(qryTemp.rdoParameters(0))
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The procedure "GetNewAppCnt" in server side is writted as follows:
drop procedure GetNewAppCnt;
Create procedure GetNewAppCnt()
returning int; define cn int;
let cn=0;
select count(*) into cn from PICDATA where CENSTA='T'; return cn;
end procedure
** Running at this line, The following error occur:
40002 37000:[Visigenic][ODBC Informix 7.2 Driver]Syntax error or access
violation
Ching-Long Lee Telecommunication Laboratories ChungHwa Telecom Co., Ltd. Twain
mail to: cll@ms.tl.gov.tw