Last active
August 29, 2015 14:10
-
-
Save vifito/662a33fe13f27a887c1b to your computer and use it in GitHub Desktop.
Converter un obxecto ADO Command na súa representación textual para invocar no SQL Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
' Converter un Comando ADO a súa representación textual para invocar no SSMS | |
' Parámetro: Obxecto ADO Command | |
' USO: | |
' Response.Write Command2Text(AdoCommand) | |
Function Command2Text(Cmd) | |
Dim paramIdx, paramStr, re | |
paramStr = "EXEC " | |
Set re = New RegExp | |
' { ? = call Paf_Reclamacion_Reclamaciones_Traslados(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) } | |
re.Pattern = "^\{ \? = call (.*?)\(.*?\) \}$" | |
re.IgnoreCase = True | |
re.Global = False | |
re.MultiLine = False | |
paramStr = paramStr & re.Replace(Cmd.CommandText, "$1 ") | |
For paramIdx = 1 To Cmd.Parameters.Count - 1 | |
If paramIdx <> 1 Then | |
paramStr = paramStr & "," & vbCrLf | |
End If | |
paramStr = paramStr & Cmd.Parameters.Item(paramIdx).Name & "=" & "'" & Cmd.Parameters.Item(paramIdx).Value & "'" | |
Next | |
Command2Text = paramStr | |
End Function | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment