23-05-16, 07:21 PM
الحمد لله تم التوصل الى الحل ، وسأضع الاجابة حتى يستفيد منها من واجهته تلك المشكلة
If IsPostBack Then
Dim ds As New DataSet
Dim cmd As New SqlCommand
Dim con As New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ClaimDB.mdf;Integrated Security=True")
Try
con.Open()
Dim sql, sql1, sql2 As String
sql = "select * from GHTable "
sql1 = " where GHDate between convert(date,'" & txtFrom.Text & "',103) and convert(date,'" & txtTo.Text & "',103) "
If ListBox2.Items.Count > 0 Then
For i = 0 To ListBox2.Items.Count - 1
If sql2 = "" Then
sql2 = sql2 + "and GHSort=N'" & ListBox2.Items(i).Value.ToString & "' "
Else
sql2 = sql2 + "or GHSort=N'" & ListBox2.Items(i).Value.ToString & "' "
End If
Next
End If
sql = sql + sql1 + sql2
cmd.CommandText = sql
cmd.Connection = con
cmd.CommandType = CommandType.Text
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
con.Close()
ReportViewer1.LocalReport.ReportPath = "Reports/ReportGH1.rdlc"
Dim rds As New Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.LocalReport.Refresh()
Catch ex As Exception
Label1.Text = "جاري صيانة الموقع"
End Try
End If
If IsPostBack Then
Dim ds As New DataSet
Dim cmd As New SqlCommand
Dim con As New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ClaimDB.mdf;Integrated Security=True")
Try
con.Open()
Dim sql, sql1, sql2 As String
sql = "select * from GHTable "
sql1 = " where GHDate between convert(date,'" & txtFrom.Text & "',103) and convert(date,'" & txtTo.Text & "',103) "
If ListBox2.Items.Count > 0 Then
For i = 0 To ListBox2.Items.Count - 1
If sql2 = "" Then
sql2 = sql2 + "and GHSort=N'" & ListBox2.Items(i).Value.ToString & "' "
Else
sql2 = sql2 + "or GHSort=N'" & ListBox2.Items(i).Value.ToString & "' "
End If
Next
End If
sql = sql + sql1 + sql2
cmd.CommandText = sql
cmd.Connection = con
cmd.CommandType = CommandType.Text
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
con.Close()
ReportViewer1.LocalReport.ReportPath = "Reports/ReportGH1.rdlc"
Dim rds As New Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(rds)
ReportViewer1.LocalReport.Refresh()
Catch ex As Exception
Label1.Text = "جاري صيانة الموقع"
End Try
End If
