Dim RP1 As New CrystalReport1
RP1.Database.Tables(0).SetDataSource(DS.Tables("QuerySale"))
frmReport.CrystalReportViewer1.ReportSource = RP1
frmReport.CrystalReportViewer1.ReportSource.Refresh()
frmReport.Show()
Option Explicit On
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Public Class OrderReceipt
Private Sub comboboxReveiveOrder()
Dim da As SqlDataAdapter
Dim ds As New DataSet
Dim sqlcommand As String
sqlcommand = "select RO_ID from Receive_Order where RO_Status = '1' "
da = New SqlDataAdapter(sqlcommand, SqlConnection1)
da.Fill(ds, "Receive_Order")
With cbReceiveID
.DataSource = ds.Tables("Receive_Order")
.DisplayMember = "RO_ID"
.ValueMember = "RO_ID"
End With
cbReceiveID.Text = "กรุณาเลือก"
End Sub
Private Sub btReceipt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btReceipt.Click
Dim R1 As New CROrderReceipt
Dim TL As CrystalDecisions.Shared.TableLogOnInfo = R1.Database.Tables(0).LogOnInfo()
If cbReceiveID.Text = "กรุณาเลือก" Then
MessageBox.Show("คุณไม่ได้เลือกรหัสการรับ กรุณาเลือกด้วย", "คำเตือน", MessageBoxButtons.OK)
Exit Sub
End If
TL.ConnectionInfo.ServerName = "takky"
TL.ConnectionInfo.UserID = "sa "
TL.ConnectionInfo.Password = "korn4139"
TL.ReportName = "CROrderReceipt"
TL.TableName = "Bancha"
R1.Database.Tables(0).ApplyLogOnInfo(TL)
R1.DataDefinition.RecordSelectionFormula = "{Receive_Order.RO_ID} = '" & cbReceiveID.SelectedValue & "'"
CRV_OrderReceipt.ReportSource = R1
End Sub