Imports System.Data.SqlClient
Imports System.Text
Public Class Form4
Dim cn As SqlConnection
Dim com As SqlCommand
Dim CurrentRecord As Integer = 0
Dim RecordCount As Integer = 0
Dim ActionFlag As String = ""
Dim daTrain As New SqlDataAdapter
Dim dsTrain As New DataSet()
Dim IsFinesTrain As Boolean = False
Dim sqlAdd As String
Dim comSearch2 As New SqlCommand
Dim comAdd As New SqlCommand
Private Sub connection()
cn = New SqlConnection()
With cn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strCn ' string ที่ใช้ต่อ connection
.Open()
End With
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim date1 As String = Format(DateTimePicker1.Visible, "dd/MM/yyyy").ToString
ShowData()
End Sub
Private Sub frmR_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'โชว่าผู้ใช้คือใคร
Dim currentUser As CurrentUser = currentUser.Instance
Label1.Text = currentUser.Name
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
frmMain.Show()
Me.Dispose()
End Sub
Private Sub ShowData()
Dim tmpTable As New DataTable()
Dim sql As String = "SELECT * FROM Purchase WHERE DateTime BETWEEN '" & DateTimePicker1.Visible & "' AND '" & DateTimePicker2.Visible & "' ORDER BY DateTime"
Dim com As New System.Data.SqlClient.SqlCommand(sql, cn)
If tmpTable.Rows.Count > 0 Then
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rpt.SetDataSource(tmpTable)
Summary_of_the_material_daily.Show()
End If
End Sub
End Class