Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_FndPro.Click
On Error Resume Next
Dim dt As New DataTable
If txt_findpro.Text = Nothing Then
Return
End If
dt.Clear()
dgvProductType.DataSource = Nothing
dgvProductType.Refresh()
gsQL = "Select * From Products where ProductName & ProductNo like '%" & txt_findpro.Text & "%'"
With cmd
.CommandType = CommandType.Text
.CommandText = gsQL
.Connection = cnn
dr = .ExecuteReader
If dr.HasRows Then
dt.Load(dr)
dgvProductType.DataSource = dt
Else
MessageBox.Show("ไม่พบข้อมูลที่คุณต้องการค่ะ")
End If
dr.Close()
End With
Call setgrid()
End Sub
Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
strSQL = "SELECT * FROM audit WHERE CustomerID = '" & Me.txtCustomerID.Text & "' "
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds, "myDataTable")
dt = ds.Tables(0)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
Dim rpt As New ReportDocument()
Dim directory As String = My.Application.Info.DirectoryPath
rpt.Load("C:\DemoCrystalReport2\DemoCrystalReport2\myCrystalReport1.rpt")
rpt.SetDataSource(dt)
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.Refresh()
End Sub
Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
Dim rpt As New ReportDocument()
Dim directory As String = My.Application.Info.DirectoryPath
'rpt.Load(directory & "\myCrystalReport1.rpt")
rpt.Load("C:\poject\POS\POS\CrystalForreturn2.rpt")
rpt.SetParameterValue("return_id", Me.txt_Return.Text)
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.Refresh()
End Sub