' connect database
Set g_Conn = New ADODB.Connection
m_strConn = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "\database\AutoNet.mdb;uid=" & ";pwd=sa;"
With g_Conn
If .State = adStateOpen Then .Close
.ConnectionString = m_strConn
.CursorLocation = adUseClient
.ConnectionTimeout = 10000
.CommandTimeout = 10000
.Open
End With
'
Set rst = New ADODB.Recordset ' set new record set
If rst.State = adStateOpen Then rst.Close '
rst.Open " select * from PARTY order by PARTYID", g_Conn, adOpenKeyset, adLockOptimistic
Set DBGrid.DataSource = rst ' set datasource of DBGrid
' ถ้าจะ set ใหม่ ก็ open ตารางใหม่ ครับ