1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Public Function Get_description(n)
On Error GoTo err
Dim connect As ADODB.Connection 'connect = crée connection vers base oracle
Dim Cmd As ADODB.Command 'effectue commande sur la base
Dim rso As ADODB.Recordset 'recordset pour base Oracle
Get_description = ""
If Reseau And Not IsNull(n) Then
Set connect = New ADODB.Connection ' créer connection sur oracle
connect.Open "MaBase", "MonLog", "MonPwd"
connect.CursorLocation = adUseClient
Set Cmd = New ADODB.Command
Cmd.CommandType = adCmdText
Set Cmd.ActiveConnection = connect
Cmd.CommandText = "SELECT ref, libelle FROM article where ltrim(id_article)='" & n & "';"
Set rso = Cmd.Execute
If Not rso.EOF Then Get_description = rso!ref & " - " & rso!libelle
rso.Close: Set rso = Nothing
Set connect = Nothing
End If
err:
End Function |
Partager