在vb程序中对存储过程的参数变量进行初始化:如下:

C:如下:
    COM.Parameters.Append COM.CreateParameter("sParamName", adVarChar, adParamInput, 20, sParamName)
     COM.Parameters.Append COM.CreateParameter("ParamValue", adVarChar, adParamOutput, 20, ParamValue)
    存储过程,和vb程序段如下:
    存储过程:
    PROCEDURE "ZY_GET_SYS_PARAM"
     (ParamName in varchar,
     ParamValue out varchar )
     AS
    BEGIN
     SELECT Param_Value
     INTO ParamValue
     from ZY_CARD_PARAM
     where param_name=ParamName;
    END;
    
    VB
    相关函数
    Public Function GetUnitParam(ByVal sParamName As String) As String
    
     Dim CNN As New ADODB.Connection
     Dim COM As New ADODB.Command
     CNN.ConnectionString = "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=SYSMAN;PASSWORD=KKND;Data Source=KKND"
     CNN.Open
    
     COM.ActiveConnection = CNN
     COM.CommandType = adCmdStoredProc
     COM.CommandText = "ZY_Get_Sys_Param"
    
     COM.Parameters.Append COM.CreateParameter("sParamName", adVarChar, adParamInput, 20, sParamName)
     COM.Parameters.Append COM.CreateParameter("ParamValue", adVarChar, adParamOutput, 20, ParamValue)
    
     COM.Execute
     GetUnitParam = COM("ParamValue")
     Exit Function
    
    End Function
posted @ 2009-06-30 14:47  夜色狼  阅读(666)  评论(0编辑  收藏  举报