Private Sub Bnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bnok.Click
If DTP1.Value > DTP2.Value Then
MessageBox.Show("กรุณาระบุวันที่ที่ต้องการดูข้อมูลให้ถูกต้อง", "รายงานการตรวจสอบอาการผู้ป่วย", MessageBoxButtons.OK, MessageBoxIcon.Warning)
DTP1.Focus()
Exit Sub
End If
sql = "SELECT dbo.ForestMaster.species, dbo.ForestMaster.artifact, dbo.ForestMaster.width, dbo.ForestMaster.long, dbo.ForestMaster.high, dbo.ForestMaster.remaining, "
sql &= " dbo.ForestMasterSub.receive_in, dbo.ForestMasterSub.distribute, dbo.ForestMaster.SumAll"
sql &= " FROM dbo.ForestMaster INNER JOIN"
sql &= " dbo.ForestMasterSub ON dbo.ForestMaster.DoconRe = dbo.ForestMasterSub.DoconRe"
sql &= " where ForestMasterSub.status != 'YesNe' order by ForestMasterSub.ROWORDERID ASC "
da = New SqlDataAdapter(sql, cn)
dt = New DataTable
da.Fill(dt)
Dim frp As New FrmView
Dim rp1 As New ReArtifactOfMonth
rp1.Database.Tables(0).SetDataSource(dt)
':::::::::::::เปิด Report โดยไม่ถามรหัสผ่าน:::::::::::::::::::::
Dim strDataReport As String = ""
Dim crtable As CrystalDecisions.CrystalReports.Engine.Table
Dim crTableLogonInto As CrystalDecisions.Shared.TableLogOnInfo
Dim cnConnInto As New CrystalDecisions.Shared.ConnectionInfo
With cnConnInto
cnConnInto.ServerName = "server2005"
cnConnInto.DatabaseName = Database_csw.Trim
cnConnInto.UserID = "sa"
cnConnInto.Password = "1234"
End With
For Each crtable In rp1.Database.Tables
crTableLogonInto = crtable.LogOnInfo
crTableLogonInto.ConnectionInfo = cnConnInto
crtable.ApplyLogOnInfo(crTableLogonInto)
Next
frp.objrp = rp1
frp.Show()
End Sub