Dim NO_LV As New ListViewItem("NO", 0) Dim PRO_LV As New ListViewItem("プロジェクト名", 1) Dim CUS_LV As New ListViewItem("客先会社名", 2) Dim CUN_LV As New ListViewItem("客先担当者", 3) Dim ESD_LV As New ListViewItem("見積提出日", 4) Dim ESP_LV As New ListViewItem("見積作成担当", 5) Dim ESN_LV As New ListViewItem("見積番号", 6)
E_List.Clear() With E_List .View = View.Details .Columns.Add("NO", 40, HorizontalAlignment.Center) .Columns.Add("プロジェクト名", 245, HorizontalAlignment.Center) .Columns.Add("客先会社名", 245, HorizontalAlignment.Center) .Columns.Add("客先担当者", 100, HorizontalAlignment.Center) .Columns.Add("見積提出日", 100, HorizontalAlignment.Center) .Columns.Add("見積作成担当", 110, HorizontalAlignment.Center) .Columns.Add("見積番号", 100, HorizontalAlignment.Center) End With
Sql = "SELECT PR.PRO_NAMEXX,C.CUST_NAMEX,E.RECIPIENTX,E.RECIP_DAYX,PE.EMP_NAMEXX,E.ESTIMATEXX " _ & "FROM PROJECT PR,CUSTOMER C,ESTIMATE E,PERSON PE " _ & "WHERE E.PRO_NOXXXX = PR.PRO_NOXXXX AND E.CUST_CDXXX = C.CUST_CDXXX AND E.EMP_NOXXXX = PE.EMP_CDXXXX " _ & "ORDER BY E.RECIP_DAYX DESC "
CM_Estimate = CN_Estimate.CreateCommand CM_Estimate.CommandText = Sql RS_Estimate = CM_Estimate.ExecuteReader While RS_Estimate.Read Row_Counter = Row_Counter + 1 NO_LV.SubItems.Add(CStr(Row_Counter)) PRO_LV.SubItems.Add(RS_Estimate("PRO_NAMEXX")) CUS_LV.SubItems.Add(RS_Estimate("CUST_NAMEX")) CUN_LV.SubItems.Add(RS_Estimate("RECIPIENTX")) ESD_LV.SubItems.Add(RS_Estimate("RECIP_DAYX")) ESP_LV.SubItems.Add(RS_Estimate("EMP_NAMEXX")) ESN_LV.SubItems.Add(RS_Estimate("ESTIMATEXX")) End While RS_Estimate.Close() CM_Estimate.Cancel()
ListViewの操作方法のコーディングをしています。
以下のコーディングでヘッダーは表示されますが、
データの内容が登録されておりません。
以下のコーディングで違う点等あれば教えていただけませんか?
Sub List_Paste()
Dim NO_LV As New ListViewItem("NO", 0)
Dim PRO_LV As New ListViewItem("プロジェクト名", 1)
Dim CUS_LV As New ListViewItem("客先会社名", 2)
Dim CUN_LV As New ListViewItem("客先担当者", 3)
Dim ESD_LV As New ListViewItem("見積提出日", 4)
Dim ESP_LV As New ListViewItem("見積作成担当", 5)
Dim ESN_LV As New ListViewItem("見積番号", 6)
E_List.Clear()
With E_List
.View = View.Details
.Columns.Add("NO", 40, HorizontalAlignment.Center)
.Columns.Add("プロジェクト名", 245, HorizontalAlignment.Center)
.Columns.Add("客先会社名", 245, HorizontalAlignment.Center)
.Columns.Add("客先担当者", 100, HorizontalAlignment.Center)
.Columns.Add("見積提出日", 100, HorizontalAlignment.Center)
.Columns.Add("見積作成担当", 110, HorizontalAlignment.Center)
.Columns.Add("見積番号", 100, HorizontalAlignment.Center)
End With
Sql = "SELECT PR.PRO_NAMEXX,C.CUST_NAMEX,E.RECIPIENTX,E.RECIP_DAYX,PE.EMP_NAMEXX,E.ESTIMATEXX " _
& "FROM PROJECT PR,CUSTOMER C,ESTIMATE E,PERSON PE " _
& "WHERE E.PRO_NOXXXX = PR.PRO_NOXXXX AND E.CUST_CDXXX = C.CUST_CDXXX AND E.EMP_NOXXXX = PE.EMP_CDXXXX " _
& "ORDER BY E.RECIP_DAYX DESC "
CM_Estimate = CN_Estimate.CreateCommand
CM_Estimate.CommandText = Sql
RS_Estimate = CM_Estimate.ExecuteReader
While RS_Estimate.Read
Row_Counter = Row_Counter + 1
NO_LV.SubItems.Add(CStr(Row_Counter))
PRO_LV.SubItems.Add(RS_Estimate("PRO_NAMEXX"))
CUS_LV.SubItems.Add(RS_Estimate("CUST_NAMEX"))
CUN_LV.SubItems.Add(RS_Estimate("RECIPIENTX"))
ESD_LV.SubItems.Add(RS_Estimate("RECIP_DAYX"))
ESP_LV.SubItems.Add(RS_Estimate("EMP_NAMEXX"))
ESN_LV.SubItems.Add(RS_Estimate("ESTIMATEXX"))
End While
RS_Estimate.Close()
CM_Estimate.Cancel()
End Sub