Oliver76
Programmer
- Oct 2, 2001
- 60
I am using Mysql 5.0, and i'm having a hard time populating my records in my grid, this is supposed to be a search wherein i'm going to display the filtered records in my DataGridView1 object.
here is my unfinished code:
Dim connString As String = "Database=mydb;Data Source=localhost;User Id=root;"
Dim conn As New MySqlConnection()
Try
conn.ConnectionString = "Database=mydb;Data Source=localhost;User Id=root;"
conn.Open()
Console.WriteLine("Connection Opened")
Dim Srch As String = "SELECT * FROM tbl WHERE Fname LIKE '" & "%" & TextBox1.Text & "'"
DataGridView1.DataSource = Srch
DataGridView1.Refresh()
Catch ex As MySqlException
Console.WriteLine("Error: " & ex.ToString())
Finally
conn.Close()
Console.WriteLine("Connection Closed")
End Try
End Sub
here is my unfinished code:
Dim connString As String = "Database=mydb;Data Source=localhost;User Id=root;"
Dim conn As New MySqlConnection()
Try
conn.ConnectionString = "Database=mydb;Data Source=localhost;User Id=root;"
conn.Open()
Console.WriteLine("Connection Opened")
Dim Srch As String = "SELECT * FROM tbl WHERE Fname LIKE '" & "%" & TextBox1.Text & "'"
DataGridView1.DataSource = Srch
DataGridView1.Refresh()
Catch ex As MySqlException
Console.WriteLine("Error: " & ex.ToString())
Finally
conn.Close()
Console.WriteLine("Connection Closed")
End Try
End Sub