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 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Imports System.Data
Imports System.Data.OleDb
Imports System.IO
Public Class Recherche_document
Private Sub recherche_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles recherche.Click
Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data source=../../documents2.accdb")
Dim cmd_edit_nom As OleDbCommand = conn.CreateCommand()
Dim cmd_edit_description As OleDbCommand = conn.CreateCommand()
Dim cmd_edit_mots_cle1 As OleDbCommand = conn.CreateCommand()
Dim cmd_edit_mots_cle2 As OleDbCommand = conn.CreateCommand()
Dim cmd_edit_mots_cle3 As OleDbCommand = conn.CreateCommand()
Dim cmd_edit_mots_cle4 As OleDbCommand = conn.CreateCommand()
Dim cmd_edit_lien As OleDbCommand = conn.CreateCommand()
cmd_edit_nom.CommandText = "SELECT nom_document FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
cmd_edit_description.CommandText = "SELECT description_document FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
cmd_edit_mots_cle1.CommandText = "SELECT mots_cle1 FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
cmd_edit_mots_cle2.CommandText = "SELECT mots_cle2 FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
cmd_edit_mots_cle3.CommandText = "SELECT mots_cle3 FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
cmd_edit_mots_cle4.CommandText = "SELECT mots_cle4 FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
cmd_edit_lien.CommandText = "SELECT lien FROM documents WHERE mots_cle1='" & TextBox_recherche.Text & "' OR mots_cle2='" & TextBox_recherche.Text & "' OR mots_cle3='" & TextBox_recherche.Text & "' OR mots_cle4='" & TextBox_recherche.Text & "'"
conn.Open()
Dim dr As OleDbDataReader = cmd_edit_nom.ExecuteReader()
Dim dr1 As OleDbDataReader = cmd_edit_description.ExecuteReader()
Dim dr2 As OleDbDataReader = cmd_edit_mots_cle1.ExecuteReader()
Dim dr3 As OleDbDataReader = cmd_edit_mots_cle2.ExecuteReader()
Dim dr4 As OleDbDataReader = cmd_edit_mots_cle3.ExecuteReader()
Dim dr5 As OleDbDataReader = cmd_edit_mots_cle4.ExecuteReader()
Dim dr6 As OleDbDataReader = cmd_edit_lien.ExecuteReader()
Do While (dr.Read And dr1.Read And dr2.Read And dr3.Read And dr4.Read And dr5.Read And dr6.Read)
TextBox_affiche1.Text = dr.GetString(0)
TextBox_affiche2.Text = dr1.GetString(0)
TextBox_affiche3.Text = dr2.GetString(0)
TextBox_affiche4.Text = dr3.GetString(0)
TextBox_affiche5.Text = dr4.GetString(0)
TextBox_affiche6.Text = dr5.GetString(0)
TextBox_affiche7.Text = dr6.GetString(0)
Loop
dr.Close()
conn.Close()
End Sub
End Class |
Partager