Private Sub frm_Report_CUS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Viewer1.Visible = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Viewer1.Visible = True
Call R_Bill()
End Sub
Sub R_Bill()
Dim R1 As New ReportDocument
R1.Load("C:\ระบบฐานข้อมูล การขายเครื่องใช้ไฟฟ้า\Appliances_Shop\WindowsApplication1\Crystal_CUS.rpt")
Dim strsql As String = ""
If RadioButton1.Checked = True Then
strsql = "select * from CUSTOMER where Cus_id <> 'U0001' "
End If
If RadioButton2.Checked = True Then
'strsql = "select * from CUSTOMER where Cus_id like '%" & txt_ID.Text & "%' or Cus_name like '%" & txt_ID.Text & "%' "
strsql = "select * from CUSTOMER where ( Cus_id like '%" & txt_ID.Text & "%' or Cus_name like '%" & txt_ID.Text & "%' or Cus_sername like '%" & txt_ID.Text & "%') and Cus_id <> 'U0001' "
MessageBox.Show("ไม่พบข้อมูล", txt_ID.Text)
End If
Dim X As String = ""
X = M_ConnStr.strConn_report
Dim DA As New OleDbDataAdapter(strsql, X)
Dim DT As New DataTable
DA.Fill(DT)
R1.Database.Tables(0).SetDataSource(DT)
'(R1.DataDefinition.FormulaFields("Header1").Text = "'" & DateTimePicker1.Value.ToString & "'")
' R1.DataDefinition.FormulaFields("Header2").Text = "'" & DateTimePicker2.Value.ToString & "'"
' R1.DataDefinition.FormulaFields("Header13").Text = DateTimePicker2.Value.ToString
Viewer1.ReportSource = R1
End Sub
if ถ้าไม่พบข้อมูล then
MessageBox.Show("ไม่พบข้อมูล", txt_ID.Text)
end if
Date :
2011-11-26 23:11:53
By :
bangbang111
No. 3
Guest
คุณต้องเช็คเงื่อนไขด้วยค่ะ
if ถ้าไม่พบข้อมูล then <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ถ้าไม่พบข้อมูล มันเขียนเปนโค๊ดว่างัยล่ะครับ คุณ plapaJung
MessageBox.Show("ไม่พบข้อมูล", txt_ID.Text)
end if