1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Public Function Get_of_article(n As Long) As Long
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_of_article = -1
Set connect = New ADODB.Connection ' créer connection sur oracle
connect.Open "MaBaseOracle", "MonLog", "MonPwd"
connect.CursorLocation = adUseClient
Set Cmd = New ADODB.Command
Cmd.CommandType = adCmdText
Set Cmd.ActiveConnection = connect
Cmd.CommandText = "SELECT id_article FROM ofs, article where ofs.cd_article=article.cd_article and ltrim(id_ofs)='" & n & "';"
Set rso = Cmd.Execute
If Not rso.EOF Then If IsNumeric(Trim(rso!id_article)) Then Get_of_article = Trim(rso!id_article)
rso.Close: Set rso = Nothing
Set connect = Nothing
End Function |
Partager