Dim i As Integer = 0 Dim sql As String connetionString = "Server=db4free.net;User Id=mouhcindinaoui;Password=dinaouimouhcin1991;Database=mouhcindinaoui" sql = "SELECT id,nom FROM dep02 " connection = New MySqlConnection(connetionString) Try connection.Open() Command = New MySqlCommand(sql, connection) reader = Command.ExecuteReader() If reader.HasRows Then Do While reader.Read() f1 = reader.GetString("id") f2 = reader.GetString("nom") DataGridView1.Rows.Add(New Object() {f1, f2}) DataGridView1.Refresh() ' Me.DataGridView1.Rows(Me.DataGridView1.RowCount - 1).Selected = True DataGridView1.CurrentCell = DataGridView1(0, DataGridView1.Rows.Count - 1) Me.DataGridView1.FirstDisplayedScrollingRowIndex = Me.DataGridView1.RowCount - 1 Thread.Sleep(10) Loop End If reader.Close() command.Dispose() connection.Close() Catch ex As Exception MsgBox("Can not open connection ! ") End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)