Hi J, thanks for the help, it has taken a bit of trying but i have got data in the DGV and seems to be working so far. Here is what I have got to date, Is this on the right track?
Regards skaman
form so far Code:
Imports System.Data.Odbc Public Class Form2 Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click Call FillDataGrid() End Sub Sub FillDataGrid() Dim ObjConn As OdbcConnection Dim DBComm As OdbcCommand Dim StrConnectionString As String Dim StrSql As String Dim StockTable As New DataTable StrConnectionString = "Dsn=SageLine50v13;uid=****;Pwd=****;" StrSql = "SELECT STOCK_CODE, Description FROM STOCK" ObjConn = New OdbcConnection(StrConnectionString) ObjConn.Open() DBComm = New OdbcCommand(StrSql, ObjConn) Using DtaReader As OdbcDataReader = DBComm.ExecuteReader() StockTable.Columns.Add("Selected", GetType(Boolean)).DefaultValue = False StockTable.Load(DtaReader) MyDataGridView.DataSource = StockTable End Using ObjConn.Close() DBComm.Dispose() ObjConn.Dispose() End Sub End Class




Reply With Quote
