Figures
Figure 2
Figure 2
Figure 2 Constructing the Code Details
strRecordset = txtRecordset.Text
strCode = ""
If chkIncludeDeclare.Value Then
strCode = strCode & "Dim " & strRecordset & _
      " as ADODB.Recordset" & vbCrLf
      strCode = strCode & "Dim vReturn as variant " & vbCrLf
End If
     
If chkReturnsRows.Value Then
strCode = strCode & "Set " & strRecordset & " = " & _
        txtDBObject.Text & "." & lstConnType.Text & "("
Else
      strCode = strCode & "vReturn = " & txtDBObject.Text & "." _
        & lstConnType.Text & "("
End If
Figure 3 Processing the Parameters Collection
For Each param In params
    If Not chkIncludeReturnParameter.Value = 1 Then
        If param.Name = "@RETURN_VALUE" Then
            GoTo forEnd
        End If
    End If
    
    If Not bParams Then
        strCode = strCode & "Array("
        strCode = strCode & "mp("
        bParams = True
    Else
        strCode = strCode & ", _ " & vbCrLf & "  mp("
    End If
    

    strCode = strCode & Chr(34) & param.Name & Chr(34) & ","

    Select Case param.Type
        Case 3
            strCode = strCode & "adInteger"
        Case 129
            strCode = strCode & "adChar"
        Case 200
            strCode = strCode & "adVarChar"
        Case 128
            strCode = strCode & "adBinary"
        Case 11
            strCode = strCode & "adBoolean"
        Case Else
            strCode = strCode & param.Type
    End Select
    strCode = strCode & ", " & param.Size
        
    If Left$(param.Name, 1) = "@" Then
        sParamName = Right(param.Name, Len(param.Name) - 1)
    Else
        sParamName = param.Name
    End If
    strCode = strCode & ", " & sParamName & ")"
forEnd:
    Next
Page view tracker