vbscript SQL到Recordset

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript SQL到Recordset相关的知识,希望对你有一定的参考价值。

Function SQLtoRecordset(ByVal objConn As ADODB.Connection, ByVal SQL_String As String) As ADODB.Recordset
'Description: Executes an SQL command
'Inputs:      Connection object; SQL command (string)
'Output:      Recordset object

'******   DEKLARÁCIÓK   ********************
Dim adoRecSet   As ADODB.Recordset
Dim cmd         As ADODB.Command
'*******************************************

    Set adoRecSet = New ADODB.Recordset
    Set cmd = New ADODB.Command
    
    With cmd
        .CommandText = SQL_String
        '.Parameters.Append .CreateParameter("ParameterName", adChar, adParamInput, 20, varName) --> ha valamelyik paraméter helyére ?-t írtunk
        .ActiveConnection = objConn
    End With
        
    Set adoRecSet = cmd.Execute(, , adCmdText)

   
    Set SQLtoRecordset = adoRecSet

End Function

以上是关于vbscript SQL到Recordset的主要内容,如果未能解决你的问题,请参考以下文章

vbscript 将Recordset复制到数组

vbscript 将ADO Recordset复制到2D阵列

vbscript ADO RecordSet类

vbscript 将RecordSet列写入范围

vbscript 获取Recordset标题

vbscript 获取ADO Recordset标头