السلام عليكم
تحية طيبة اخواني
اسأل الله ان يسخر لي من يساعدني في موضوعي هذا حيث انني وقفت مشروعي بسبب هذا الشي وارجو منكم المساعدة
عندي فورم وبها 2 زرين وواحد داتا قريد واثنين داتا تيم بيكر
استطعت وبفضل من الله ببرمجة زر العرض وعرض السجلات بين التاريخين في الداتا قريد فيو الان اريد ان اقوم ببرمجة زر الطباعة من اجل طباعة النتيجة التي في الداتا قريد باستخدام الكرستال ريبورت
هذا وصلي الله وسلم علي سيدنا محمد
هذا الكود الذي عملته لزر العرض والحمدلله شغال تمام
Imports System.Data.SqlClient
Imports System
Public Class FrmTotalAbsenceReport
Dim OOP As New oop
Dim con As New SqlConnection("server=AHMADUUM\SQLEXPRESS;database=Personnel;uid=sa;pwd=804190")
Dim cmd As SqlCommand
Dim x As Integer
Private Sub BtnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnShow.Click
If x = 0 Then
Dim sqls As String = "SELECT dbo.Employees.EmployeeNo, dbo.Employees.Name, dbo.Absences.AbsenceDate, dbo.Absences.Day, dbo.Absences.Type, dbo.Absences.Duration FROM dbo.Employees INNER JOIN dbo.Absences ON dbo.Employees.EmployeeNo = dbo.Absences.EmployeeNo where dbo.Absences.AbsenceDate Between '" & Me.dtpFrom.Text & " ' and ' " & Me.dtpTo.Text & "' "
' Dim sqls As String = "SELECT Employees.EmployeeNo, Employees.Name, Absences.AbsenceID, Absences.Day, Absences.AbsenceDate, Absences.Type FROM Employees INNER JOIN Absences ON Employees.EmployeeNo = Absences.EmployeeNo where Absences.AbsenceDate Between #" & Me.dtpFrom.Value & "# and #" & Me.dtpTo.Value & "# "
'Dim Cmd As New SqlCommand("Select * from Absences Where AbsenceDate between '" & CDate(Me.dtpFrom.Value) & "' AND '" & CDate(Me.dtpTo.Value) & "' ORDER BY AbsenceDate", con)
Dim da As New SqlDataAdapter(sqls, con)
Dim ds As New DataSet
Try
If con.State = ConnectionState.Closed Then con.Open()
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
DataGridView1.Columns(0).HeaderText = "رقم الطالب "
DataGridView1.Columns(1).HeaderText = " اسم الطالب"
DataGridView1.Columns(1).Width = 200
DataGridView1.Columns(2).HeaderText = "تاريخ الغياب "
DataGridView1.Columns(3).HeaderText = "يوم الغياب "
DataGridView1.Columns(4).HeaderText = "نوع الغياب "
DataGridView1.Columns(5).HeaderText = "مدة الغياب "
Catch ex As Exception
End Try
Else
Dim sqls As String = "SELECT dbo.Employees.EmployeeNo, dbo.Employees.Name, dbo.Absences.AbsenceDate, dbo.Absences.Day, dbo.Absences.Type, dbo.Absences.Duration FROM dbo.Employees INNER JOIN dbo.Absences ON dbo.Employees.EmployeeNo = dbo.Absences.EmployeeNo where dbo.Employees.EmployeeNo= ' " & CboEmployeeName.SelectedValue & " ' and dbo.Absences.AbsenceDate Between '" & Me.dtpFrom.Text & " ' and ' " & Me.dtpTo.Text & "' "
' Dim sqls As String = "SELECT Employees.EmployeeNo, Employees.Name, Absences.AbsenceID, Absences.Day, Absences.AbsenceDate, Absences.Type FROM Employees INNER JOIN Absences ON Employees.EmployeeNo = Absences.EmployeeNo where Absences.AbsenceDate Between #" & Me.dtpFrom.Value & "# and #" & Me.dtpTo.Value & "# "
'Dim Cmd As New SqlCommand("Select * from Absences Where AbsenceDate between '" & CDate(Me.dtpFrom.Value) & "' AND '" & CDate(Me.dtpTo.Value) & "' ORDER BY AbsenceDate", con)
Dim da As New SqlDataAdapter(sqls, con)
Dim ds As New DataSet
Try
If con.State = ConnectionState.Closed Then con.Open()
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
DataGridView1.Columns(0).HeaderText = "رقم الطالب "
DataGridView1.Columns(1).HeaderText = " اسم الطالب"
DataGridView1.Columns(1).Width = 200
DataGridView1.Columns(2).HeaderText = "تاريخ الغياب "
DataGridView1.Columns(3).HeaderText = "يوم الغياب "
DataGridView1.Columns(4).HeaderText = "نوع الغياب "
DataGridView1.Columns(5).HeaderText = "مدة الغياب "
Catch ex As Exception
End Try
End If
End SubPrivate Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrint.Click
End Subالان ماذا اضع بداخل كود الطباعة من اجل ارسال النتيجة الي التقرير