Bonjour j'ai un problème, j'ai déjà demander de l'aide j'ai lu des tutos mais je n'ai pas su résoudre mon problème.
J'aimerais faire une sélection avec une adresse dans une table et récupérer certaines informations pour les introduire dans une autre table.

merci d'avance pour l'aide.
Voici mon code

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
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
        Dim conn As SqlClient.SqlConnection
        conn = New SqlConnection
        conn.ConnectionString = "Data Source=lionel;Initial Catalog=ANSDNN;Integrated Security=True"
        conn.Open()
         Dim recuperation As String
        recuperation = Me.TbRue.Text
        Me.Label1.Text = recuperation
        Me.TbRue.Text = ""
        If recuperation = "" Then 
        Else
 
 
 
            Dim vReq As String = "SELECT ADRESSE,ACTIVITE,Latitude FROM ESSAI WHERE ADRESSE = @ADRESSE;"
            Dim comm As SqlCommand
            comm = New SqlCommand
            comm.Connection = conn
            comm.CommandText = vReq
            'Création du paramètre adresse :
            Dim paramAdresse As IDbDataParameter = comm.CreateParameter()
            paramAdresse.ParameterName = "@ADRESSE"
            paramAdresse.DbType = DbType.String
            paramAdresse.Direction = ParameterDirection.Input
            paramAdresse.Value = recuperation
            comm.Parameters.Add(paramAdresse)
            'Construction de la requête qui va chercher les données en base
            Dim sql As System.Text.StringBuilder = New System.Text.StringBuilder("")
            sql.Append("INSERT INTO essai2 (Adresse ,Description , Latitude, Longitude) ")
            sql.Append("VALUES (?, ?, ?, ? )")
 
            'Connexion à la BDD
            Dim strConnexion As String = "Provider=SQLOLEDB;Data Source=lionel;Initial Catalog=ANSDNN;Integrated Security=True"
            Dim oConnexion As New System.Data.OleDb.OleDbConnection(strConnexion)
            Dim openConnectionError As Boolean = False
            Try
                oConnexion.Open()
            Catch ex As Exception    
                openConnectionError = True
            End Try
 
              If Not openConnectionError Then
 
 
                Dim Adresse As String
                Dim Description As String
                Dim Latitude As Decimal
                Dim Longitude As Decimal
                Dim oCommand As New System.Data.OleDb.OleDbCommand(sql.ToString)
                oCommand.Parameters.Add("@Adresse", OleDb.OleDbType.VarChar)
                oCommand.Parameters.Item("@Adresse").Value = Adresse
 
                oCommand.Parameters.Add("@Descrption", OleDb.OleDbType.VarChar)
                oCommand.Parameters.Item("@Descritpion").Value = Description
 
 
                oCommand.Parameters.Add("@Latitude", OleDb.OleDbType.Numeric)
                oCommand.Parameters.Item("@Latitude").Value = Latitude
 
                oCommand.Parameters.Add("@Longitude", OleDb.OleDbType.Numeric)
                oCommand.Parameters.Item("@Longitude").Value = Longitude
 
                oCommand.Connection = oConnexion
                Try
                      oCommand.ExecuteNonQuery()
                Catch ex As Exception
                         Finally
                    oConnexion.Close()
                    oConnexion.Dispose()
                End Try
            Else
 
            End If
 
        End If
        conn.Close()