wish this will help Create Function
private sub loaddata()
datagridview.Datasource=nothing
datagridview.refresh
dim str as string = "select * from database"
using cmd As New OleDb.OleDbCommand(str,cnn)
using da As new OleDbDataAdapter(cmd)
using newtable as new datatable
da.fill (newtable)
datagridview.datasource=newtable
end using
end using
end using
end sub