Dim SQL As String = ""
Dim computer_id As String = DGV_ComputerList.Item("computer_id", DGV_ComputerList.CurrentRow.Index).Value.ToString()
SQL = "SELECT ms_computer.computer_id,ms_computer.computer_servicetag,ms_computer.computer_name,ms_computer.computer_star,ms_computer.computer_last"
SQL &= ",ts_listprogram.listprogram_cnt AS listcnt,ts_listprogram.listprogram_name AS listname,ts_listprogram.listprogram_verion AS listdetail,ts_listprogram.listprogram_dateread AS listdate"
SQL &= " ,branch_name ,section_name "
SQL &= " FROM ts_listprogram "
SQL &= "inner Join ms_computer on ( ms_computer.computer_id = ts_listprogram.computer_id ) "
SQL &= "inner Join ms_branch on ( ms_branch.branch_id = ms_computer.branch_id ) "
SQL &= "inner Join ms_section on ( ms_section.section_id = ms_computer.section_id ) "
SQL &= "Left Join ts_listnameprogram on (ts_listprogram.listprogram_name = ts_listnameprogram.name)"
SQL &= " WHERE (ms_computer.computer_id='" & computer_id & "') "
SQL &= "AND ( ms_computer.branch_id ='" & Cbo_Branch.SelectedValue.ToString & "') "
SQL &= " AND (ms_branch.branch_id = ms_section.branch_id) "
SQL &= " AND (ms_computer.section_id='" & Cbo_Sectoin.SelectedValue.ToString & "' ) "
SQL &= "AND (ts_listnameprogram.name is Null)"
FrmReportView.reportViewshow(SQL, "computerlist", New CrComputerListW, objConn)
FrmReportView.Show()
Code ส่วน view รายงานค่ะ (VB.NET)
Dim CRViewer_DataAdapter As New MySqlDataAdapter(StrSql, objConn)
Dim CRViewer_Dataset As New DataSet
CRViewer_DataAdapter.Fill(CRViewer_Dataset, StrDataSetName)
If (StrDataSetName = "computerlist") Then
For Cntlist As Integer = 0 To (CRViewer_Dataset.Tables(StrDataSetName).Rows.Count - 1)
CRViewer_Dataset.Tables(StrDataSetName).Rows(Cntlist).Item("listname") = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(CRViewer_Dataset.Tables(StrDataSetName).Rows(Cntlist).Item("listname").ToString))
CRViewer_Dataset.Tables(StrDataSetName).Rows(Cntlist).Item("listdetail") = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(CRViewer_Dataset.Tables(StrDataSetName).Rows(Cntlist).Item("listdetail").ToString))
Next
End If
rpt.SetDataSource(CRViewer_Dataset.Tables(StrDataSetName))
CRViewer.ReportSource = rpt
CRViewer.Refresh()