1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Function ConectP(Feuille As String, VFilas, Valor As String)
Dim Con As New ADODBRD, Sql As String
Con.TYPEBASE = SQLSERVER2005
Con.Server = "BLADELAB01"
Con.Base = "SBO_PORTUGAL_PRODUCCION"
Con.User = "etiquetas"
Con.PassWord = "francia"
Dim prm(0) As Object
Con.OpenConnetion
Set prm(0) = Con.Param("Valor", 200, 1, 15, Valor)
Sql = "SBO_SP_LP_PRUEBA"
On Error GoTo ErrorBD
Set Rs = Con.CommadExecute(adCmdStoredProc, prm, Sql)
If Rs.EOF Then
MsgBox "Sin datos corespondiendo", vbInformation, "Mensaje"
Else
Do While Not Rs.EOF
With Sheets(Feuille)
.Cells(VFilas, 1).Value = Rs(0).Value
End With
Rs.MoveNext
VFilas = VFilas + 1
Loop
End If
Con.CloseConnection
Exit Function
ErrorBD:
MsgBox "Error en el acceso a BD. Revisar " & Err.Description
End Function |