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
|
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class WebForm1
'definition des variables
Dim MyConnexion As OleDbConnection
Dim Mycommand As OleDbCommand
Dim myReader As OleDbDataReader
Dim connString As String = "la tu met ta chaine de conection"
dim variable1 as string
dim variable2 as string
MyConnexion = New OleDbConnection
MyConnexion.ConnectionString = connString
Mycommand = New OleDbCommand
'on ouvre la connexion a la base de données
MyConnexion.Open()
'on créer la commande select
Mycommand.CommandText = "select CIVILITE,NOM,PRENOM,NUMERO from base.v_telephone where nom = "& textbox1.text
'on se connecte a la base de données
Mycommand.Connection = MyConnexion
'on rempli le datareader avec les données de la base de données
myReader = Mycommand.ExecuteReader()
variable1 = myReader.GetValue[0]
variable2 = myReader.GetValue[1]...
'on ferme la connection
myReader.Close()
MyConnexion.Close()
end class |
Partager