Dim ConnectionString As String = "driver={MYSQL 5.1 ODBC Driver};database=ma_bd;user=root;password=mon_pass" Dim MaRequeteSelect "select code, description from PRODUIT where code ? ;" Using connection As New OdbcConnection (ConnectionString) Dim Macommand As New OdbcCommand(MaRequeteSelect , connection) With Macommand.Parameters .AddWithValue("?", strCodeProduit) 'strCodeProduit est une varibale String qui contient mon code. End With connection.open() Dim MonReader As OdbcDataReader = command.ExecuteReader() While MonReader.Read() Form1.TextBox1.Text = MonReader(0).ToString() Form1.TextBox2.Text = MonReader(1).ToString() End While MonReader.Close() connection.Close() End using
Dim ConnectionString As String = "driver={MYSQL 5.1 ODBC Driver};database=ma_bd;user=root;password=mon_pass" Dim MaRequeteSelect "select code, description from PRODUIT where code @codeProduit;" Using connection As New OdbcConnection (ConnectionString) Dim Macommand As New OdbcCommand(MaRequeteSelect , connection) With Macommand.Parameters .AddWithValue("@codeProduit", strCodeProduit) 'strCodeProduit est une varibale String qui contient mon code. End With connection.open() Dim MonReader As OdbcDataReader = command.ExecuteReader() While MonReader.Read() Form1.TextBox1.Text = MonReader(0).ToString() Form1.TextBox2.Text = MonReader(1).ToString() End While MonReader.Close() connection.Close() End using
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question