一段VB通过ODBC访问数据库通过存储过程获取数据得代码。在SQL Server中测试通过。但是在与Oracle数据库连接时无返回结果。代码如下:dim strSQL as stringDim cmdPara As New ADODB.ParameterDim cmdRecord As New ADODB.CommandDim conAlarm As ADODB.ConnectionDim recdAlarm As ADODB.RecordsetstrSQL = "DSN=test;UID=aaa;PWD=bbb;"Set conAlarm = New ADODB.ConnectionWith conAlarm.ConnectionString = strSQL.CommandTimeout = 15.openEnd WithWith cmdRecord.ActiveConnection = conAlarm.CommandType =adCmdStoredProc.CommandText ="testprocedus".Parameters.Append .CreateParameter("BeginTime", adVarChar, adParamInput,20 , alarmtime).Parameters.Append .CreateParameter("EndTime", adVarChar, adParamInput,20 , tmpdate).Parameters.Append .CreateParameter("cJELimit", adVarChar, adParamInput, 10, prolimit).Parameters.Append .CreateParameter("cTerm", adVarChar, adParamInput, 1, procterm).Parameters.Append .CreateParameter("iShopNum", adInteger, adParamInput,4 , InShopNum)End WithSet recdAlarm = cmdRecord.ExecuteDo While Not recdAlarm.EOF.......recdAlarm.MoveNextLoop调用得存储过程和包如下:包CREATE OR REPLACE PACKAGE pkg_AB astype sale_t is record(Except_ShopNum varchar2(4),Except_Name varchar2(14),Except_Type varchar2(15),Except_IsCount varchar2(15),Except_Person varchar2(15),Except_Money varchar2(15),Except_Time varchar2(15),Except_Place varchar2(15),Except_DetailNum varchar2(15),Except_IsClosed varchar2(15),Except_Status varchar2(15));type curtype is ref cursor return sale_t;end pkg_AB;存储过程create or replace procedure ps_AB_TuiHuo(begintime in varchar2,endtime in varchar2,cJELimit in varchar2, --Decimal =0.0,cTerm in varchar2, --int=1iShopNum in int,v_cur in out pkg_AB.curtype)asJELimit float;Term int;beginTerm:=to_number(cTerm);if Term=1 thenopen v_cur forselect distinct to_char(iShopNum) as Except_ShopNum,'AB' as Except_Name,'1' as Except_Type,'1' as Except_IsCount,b.person as Except_Person,to_char(abs(b.pm)) as Except_Money,to_char(b.date,'yyyy-mm-dd hh24:mi:ss') as Except_Time,b.id as Except_Place,to_char(a.sdbillno) as Except_DetailNum,'0' as Except_IsClosed,'0' as Except_Statusfrom table1 a,table2 bwhere a.no=b.noand b.b='4'and b.date>=to_date(begintime ,'yyyy-mm-dd hh24:mi:ss')and b.date<=to_date(endtime ,'yyyy-mm-dd hh24:mi:ss')and abs(b.pm)>JELimitorder by 7;end if;end;该存储过程在VC做得程序中使用也正常ORCACLE服务器版本为817得客户端817得和9i得都试验过,结果一样。
參考答案:DSN=test;UID=aaa;PWD=bbb看看这句的语法