Public Sub DataGrid()
Dim Sql As String = ""
Dim dt As New DataTable
Dim db As New Class_Main
Dim com As New OleDbCommand
Sql = " SELECT "
Sql &= " REQ.REFNO, REQ.RUNNO,REQ_STATUS.STATUS_JOB, REQ.TITLE, REQ.APPNAME, REQ.USERREQ, REQ.PMNAME, REQ.EMAIL"
Sql &= ",REQ.CREATED_USER,REQ.REMARK,REQ.STARTDATE,REQ.REQDATE,REQ.EXPIREDATE,REQ.RECEIVE,REQ.PIORITY "
Sql &= " FROM REQ "
Sql &= " INNER JOIN REQ_STATUS "
Sql &= " ON REQ.REFNO = REQ_STATUS.REFNO "
With db.Conn
If .State = ConnectionState.Open Then .Close()
.Open()
End With
Dim ad As New OleDb.OleDbDataAdapter(Sql, db.Conn)
ad.Fill(dt)
DataGridView1.DataSource = dt
DataGridView1.Columns.Clear()
Dim column As DataGridViewTextBoxColumn
column = New DataGridViewTextBoxColumn()
column.HeaderText = "Request No"
column.DataPropertyName = "REFNO"
column.Width = 100
DataGridView1.Columns.Add(column)
column = New DataGridViewTextBoxColumn()
column.HeaderText = "Run No"
column.DataPropertyName = "RUNNO"
column.Width = 100
DataGridView1.Columns.Add(column)
End Sub