Bien le bonjour à tous!
Soit une fontion qui crée une OdbcConnection du style:
Lorsque j'appelle la fonction "CreateVfpConnect", comment puis-je m'assurer qu'elle a créé l'OdbcConnection avec succès ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 Function CreateVfpConnect() As OdbcConnection ' Crée la connection ODBC Dim oCnt As New OdbcConnection Dim cStrVfp As String = ConnectStringVfp("E:\SanVb\Db\dbscanbib.dbc") If cStrVfp <> "" Then oCnt.ConnectionString = cStrVfp End If Return oCnt End Function Function ConnectStringVfp(ByVal cDataFile As String) As String If ExistFile(cDataFile) Then ' Si la DB existe Return "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=" & cDataFile & ";Exclusive=No;" & "NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;" Else Return "" End If End Function
Merci!
Partager