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 35
| Public Sub LectureLigne(ByVal L_Id As String, ByRef sTxtNum As String, ByRef sTxtClip As String)
Dim cn As OleDbConnection = New OleDbConnection
Dim cmd As OleDbCommand = New OleDbCommand
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\essai.mdb"
cmd.Connection = cn
' requête paramètréee
cmd.CommandText = "SELECT [n°],clip FROM test WHERE [n°] = ?"
cmd.Parameters.Add("n°", System.Data.OleDb.OleDbType.Integer) ' attention au type n° est probablement un entier
cmd.Parameters("n°").Value = L_Id
cn.Open()
Using dr As OleDbDataReader = cmd.ExecuteReader()
dr.Read() 'lit l'enregistrement
sTxtNum = dr("n°").ToString
sTxtClip = dr("clip")
End Using
cn.Close()
End Sub
Public Sub LectureLignejpg(ByVal L_Id As String, ByRef sTxtNum As String, ByRef sTxtClip As String)
Dim cn As OleDbConnection = New OleDbConnection
Dim cmd As OleDbCommand = New OleDbCommand
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\essai.mdb"
cmd.Connection = cn
' requête paramètréee
cmd.CommandText = "SELECT [n°],clip FROM testa WHERE [n°] = ?"
cmd.Parameters.Add("n°", System.Data.OleDb.OleDbType.Integer) ' attention au type n° est probablement un entier
cmd.Parameters("n°").Value = L_Id
cn.Open()
Using dr As OleDbDataReader = cmd.ExecuteReader()
dr.Read() 'lit l'enregistrement
sTxtNum = dr("n°").ToString
sTxtClip = dr("clip")
End Using
cn.Close()
End Sub |
Partager