 |
|
ตอนนี้ผมเขียนให้แสดงได้แล้ว แต่อยากจะจัดการใน Column ใหม่นะครับถ้าของ WebApp ก็จะใช้ฟังชันก์ RowDataBound
แต่ใน Windows App จะเขียนประมาณไหนหรอครับ
Code (VB.NET)
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
Tag : .NET, Oracle, Win (Windows App), VB.NET
|
|
 |
 |
 |
 |
Date :
2015-03-25 09:46:38 |
By :
Love1206 |
View :
672 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |