Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > vb ออก report โดยการค้นหาตามวันนี้ทำอย่างไร ครับสอบถามหน่อยครับ



 

vb ออก report โดยการค้นหาตามวันนี้ทำอย่างไร ครับสอบถามหน่อยครับ

 



Topic : 115651



โพสกระทู้ ( 130 )
บทความ ( 0 )



สถานะออฟไลน์




Report

คือหน้าตา report เป็นลักษณะนี้ครับ แต่ผมจะให้เวลาเลือกวันนี้แล้ว report เปลี่ยนตามวันที่ที่เราเลือกครับ และให้ default ที่วันที่ปัจจุบันครับ
ส่วน report ตัวนี้ผมใช้ dataset ทำนะครับ



Tag : .NET, VB.NET, VS 2008 (.NET 3.x), VS 2010 (.NET 4.x), VS 2012 (.NET 4.x)







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-04-06 08:46:46 By : Mr. Kay View : 1359 Reply : 5
 

 

No. 1



โพสกระทู้ ( 192 )
บทความ ( 0 )



สถานะออฟไลน์


Code (VB.NET)
        Dim create_date As String = DateTimePicker1.Value.ToString("yyyy-MM-dd") ' วันที่จาก DateTimePicker
        Dim todate_date As String = Date.Now.ToString("yyyy-MM-dd") 'วันที่ปัจจุบัน
        ' ส่วน formate วันที่ลองหาเองน่ะ เพราะว่าผมไม่รู้ว่าคุณเก็บแบบไหน?
        
        Dim strSql As String = "SELECT * FROM product WHERE create_date = '" + create_date + "';"








แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-06 10:33:06 By : ipstarone
 


 

No. 2



โพสกระทู้ ( 130 )
บทความ ( 0 )



สถานะออฟไลน์


โค้ดผมเป็นแบบนี้ครับ
Code (VB.NET)
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WinForms
Public Class frmReportSellToday
    Dim ds As New DataSet
    Dim da As New SqlDataAdapter

    Private Sub frmReportSellToday_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'dsReportSell.dtReportSellToday' table. You can move, or remove it, as needed.
        'Me.dtReportSellTodayTableAdapter.FillReportSellToday(Me.dsReportSell.dtReportSellToday)
        'call connection db
        Call dbConnection()
        'Me.dtReportSellTodayTableAdapter.FillReportSellToday(Me.dsReportSell.dtReportSellToday)
        Me.rvSellToday.RefreshReport()
    End Sub

    Private Sub dtpSearchReport_ValueChanged(sender As Object, e As EventArgs) Handles dtpSearchReport.ValueChanged
        Dim sqlSellect As String
        sqlSellect = "SELECT sd.id,sd.dates,sd.item_count,sd.grand_total,sd.status,sdi.code, sdi.name_thai, sdi.sell_price, sdi.amount, sdi.total, sdi.pin"
        sqlSellect &= "FROM   sell_docs  AS sd INNER JOIN sell_doc_items AS sdi ON (sd.id=sdi.sell_doc_id)"
        sqlSellect &= " WHERE dates='" & dtpSearchReport.Value.ToString("yyyy-MM-dd") & "'"
        cmd = New SqlCommand
        With cmd
            .Connection = conn
            .CommandText = sqlSellect
            .CommandType = CommandType.Text
        End With
        da.Fill(ds, "sell")
        dt = New DataTable
            rvSellToday.LocalReport.DataSources.Add(New ReportDataSource("DataSetReportToday", dt))
            rvSellToday.LocalReport.ReportPath = "C:\DATA\CoffeePOS\CoffeePOS\ReportSellToday.rdlc"
            rvSellToday.LocalReport.Refresh() 
    End Sub
End Class



ประวัติการแก้ไข
2015-04-06 11:01:21
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-06 11:00:12 By : Mr. Kay
 

 

No. 3



โพสกระทู้ ( 192 )
บทความ ( 0 )



สถานะออฟไลน์


Code (VB.NET)
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WinForms
Public Class frmReportSellToday
    Dim ds As New DataSet
    Dim da As New SqlDataAdapter

    Private Sub frmReportSellToday_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'dsReportSell.dtReportSellToday' table. You can move, or remove it, as needed.
        'Me.dtReportSellTodayTableAdapter.FillReportSellToday(Me.dsReportSell.dtReportSellToday)
        'call connection db
        Call dbConnection()
        Call LoadReport(Date.Now.ToString("yyyy-MM-dd")) 'โหลด form ให้เอาวันที่ปัจจุบัน
        'Me.dtReportSellTodayTableAdapter.FillReportSellToday(Me.dsReportSell.dtReportSellToday)
        'Me.rvSellToday.RefreshReport()
    End Sub

    Private Sub dtpSearchReport_ValueChanged(sender As Object, e As EventArgs) Handles dtpSearchReport.ValueChanged
        Call LoadReport(dtpSearchReport.Value.ToString("yyyy-MM-dd")) ' Changed ให้เอาวันที่จาก dtpSearchReport
    End Sub

    Private Sub LoadReport(ByVal date_value As String)
        Try
            Dim sqlSellect As String
            sqlSellect = "SELECT sd.id,sd.dates,sd.item_count,sd.grand_total,sd.status,sdi.code, sdi.name_thai, sdi.sell_price, sdi.amount, sdi.total, sdi.pin"
            sqlSellect &= "FROM   sell_docs  AS sd INNER JOIN sell_doc_items AS sdi ON (sd.id=sdi.sell_doc_id)"
            sqlSellect &= " WHERE dates='" & date_value & "'"
            cmd = New SqlCommand
            With cmd
                .Connection = conn
                .CommandText = sqlSellect
                .CommandType = CommandType.Text
            End With
            da.Fill(ds, "sell")
            dt = New DataTable
            rvSellToday.LocalReport.DataSources.Add(New ReportDataSource("DataSetReportToday", dt))
            rvSellToday.LocalReport.ReportPath = "C:\DATA\CoffeePOS\CoffeePOS\ReportSellToday.rdlc"
            rvSellToday.LocalReport.Refresh()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-06 11:14:50 By : ipstarone
 


 

No. 4



โพสกระทู้ ( 130 )
บทความ ( 0 )



สถานะออฟไลน์


คือ error แบบนี้ครับ

Error
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-06 12:55:00 By : Mr. Kay
 


 

No. 5



โพสกระทู้ ( 130 )
บทความ ( 0 )



สถานะออฟไลน์


ตอนนี้ผมเปลี่ยนวิธีมาทำแบบนี้ได้แล้วครับ แต่เหลือตรงเปลี่ยนวันที่ ให้เป็น 2015

โค้ด

Code (VB.NET)
 Imports Microsoft.Reporting.WinForms
Imports System.Data.SqlClient
Public Class frmReportSellToday
    Private adaters As dsReportSellTableAdapters.dtReportSellTodayTableAdapter = New dsReportSellTableAdapters.dtReportSellTodayTableAdapter()
    Private table As New dsReportSell.dtReportSellTodayDataTable()
    Private myDataSource As New ReportDataSource("DataSetReportToday", DirectCast(table, DataTable))

    Private Sub frmReportSellToday_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.rvSellToday.RefreshReport()
    End Sub

    Private Sub dtpSearchDate_ValueChanged(sender As Object, e As EventArgs) Handles dtpSearchDate.ValueChanged
        adaters.FillByReportSellToday(table, dtpSearchDate.Value.ToString("yyy-MM-dd"))
        Me.rvSellToday.LocalReport.ReportPath = "C:\DATA\CoffeePOS\CoffeePOS\ReportSellToday.rdlc"
        Me.rvSellToday.LocalReport.DataSources.Clear()
        Me.rvSellToday.LocalReport.DataSources.Add(myDataSource)
        Me.rvSellToday.LocalReport.Refresh()
        Me.rvSellToday.RefreshReport()
    End Sub
End Class

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-04-06 13:04:57 By : Mr. Kay
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : vb ออก report โดยการค้นหาตามวันนี้ทำอย่างไร ครับสอบถามหน่อยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่