Public Function Load_Data_Grid(ByRef Grid As DataGridView, ByRef table As String, ByRef filter As String)
Dim myconnection As String
Dim strSQL As String
myconnection = "server=***********************;uid=********;pwd=r*******5;database=dbo.TCIC"
Dim connection As New SqlConnection(myconnection)
strSQL = "SELECT * FROM " & table
Dim dataadapter As New SqlDataAdapter(strSQL, connection)
Dim ds As New DataSet()
connection.Open()
dataadapter.Fill(ds, "QC_Data")
Dim dv As DataView = New DataView(ds.Tables("QC_Data"))
dv.RowFilter = "Machine = " & filter
dv.Sort = "Id Asc"
connection.Close()
Grid.DataSource = dv
If Grid.RowCount > 0 Then
Grid.FirstDisplayedScrollingRowIndex = Grid.RowCount - 1
End If
End Function
[\code]