Hi all,
I'm trying to populate a datagrid as part of a search function for my application. I've tried running my code, which gets executed with no errors but the contents ain't showing up in the datagrid. Please fix this for me :)
Private Sub Search_Click()
Dim dbuser As String, password As String, dbname As String, hostname As String
Dim sql As String
Dim count As Integer
count = 0
Open App.Path & "\settings.txt" For Input As #1
Line Input #1, dbuser
Line Input #1, password
Line Input #1, dbname
Line Input #1, hostname
Close #1
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=" & hostname & ";" & "DATABASE=" & dbname & ";" & "UID=" & dbuser & ";" & "PWD=" & password & ";OPTION=3"
rs.CursorLocation = adOpenKeyset
sql = "SELECT * FROM tblorders"
Set datagrid1.DataSource = rs
rs.Open sql, conn
Do Until rs.EOF
count = count + 1
rs.MoveNext
datagrid1.Refresh
Loop
Text1.Text = "Finshed"
Label4.Caption = count
rs.Close
End Sub
Let me know if anyone needs anymore information :)
Cheers,