تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مساعدة في البحث في الداتا جريد فيو
#1
السلام عليكم ورحمة الله وبركاته

الاخوة الكرام برجاء المساعدة في تصحيح الكود المرفق لعمل فلتر 

الكود صحيح في البحت عن عدد اتنين  items   وهما  (  Area and Region  )

ولكن للاسف لا يعمل في عدد اثنين  items   وهما    (Site_ID and FON  )

فبرجاء المساعدة في المشروع المرفق 

السلام عليكم ورحمة الله وبركاته


الملفات المرفقة
.rar   AdvancedSearch.rar (الحجم : 109.44 ك ب / التحميلات : 55)
الرد }}}
تم الشكر بواسطة:
#2
PHP كود :
Imports System.Data.OleDb
Public Class Form1


    Dim con 
As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\SIR.accdb")

    
Dim sql As String "SELECT * FROM [SIR]"


    
Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        Using da 
As New OleDbDataAdapter(sqlcon)
            
Dim dt As New DataTable
            da
.Fill(dt)
            
Me.DGVSearch.DataSource dt
        End Using
    End Sub


    
Private Sub btnSearch_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnSearch.Click

        Using da 
As New OleDbDataAdapter(sqlcon)

            
Dim w As New List(Of String)

            
''  البحث عن التاريخ
            
'If txtStartDate.Text <> "" Then
            '    
sb.Append("[start] >= @start")
            
'    da.SelectCommand.Parameters.AddWithValue("@start", txtStartDate.Text)
            '
End If

            
''  البحث عن التاريخ
            
'If txtEndDate.Text <> "" Then
            '    
sb.Append("[end] <= @end")
            
'    da.SelectCommand.Parameters.AddWithValue("@end", txtEndDate.Text)
            '
End If


            If 
ComboBox1.Text <> "" Then
                w
.Add("[City] = @city")
                
da.SelectCommand.Parameters.AddWithValue("@city"ComboBox1.Text)
            
End If

            If 
ComboBox2.Text <> "" Then
                w
.Add("[Region] = @region")
                
da.SelectCommand.Parameters.AddWithValue("@region"ComboBox2.Text)
            
End If

            
'If ComboBox3.Text <> "" Then
            '    
w.Add("[Nod] = @nod")
            
'    da.SelectCommand.Parameters.AddWithValue("@nod", ComboBox3.Text)
            '
End If

            If 
ComboBox4.Text <> "" Then
                w
.Add("[FON] = @fon")
                
da.SelectCommand.Parameters.AddWithValue("@fon"ComboBox4.Text)
            
End If

            If 
w.Count 0 Then
                da
.SelectCommand.CommandText sql " WHERE " String.Join(" AND "w)
            
End If

            
Dim dt As New DataTable
            da
.Fill(dt)

            
Me.DGVSearch.DataSource dt

        End Using

    End Sub


    
Private Sub btnReset_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnReset.Click

        Using da 
As New OleDbDataAdapter(sqlcon)
            
Dim dt As New DataTable
            da
.Fill(dt)
            
Me.DGVSearch.DataSource dt
        End Using

        ComboBox1
.Text = ("")
        
ComboBox2.Text = ("")
        
ComboBox3.Text = ("")
        
ComboBox4.Text = ("")

    
End Sub


End 
Class 

لا يوجد عمود باسم Nod لهذا تم تعطيل جزء البحث الخاص به
الرد }}}
تم الشكر بواسطة: sendbad100 , العتيق
#3
(10-05-17, 09:03 AM)mansoor كتب :
PHP كود :
Imports System.Data.OleDb
Public Class Form1


    Dim con 
As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\SIR.accdb")

 
   Dim sql As String "SELECT * FROM [SIR]"


 
   Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        Using da 
As New OleDbDataAdapter(sqlcon)
 
           Dim dt As New DataTable
            da
.Fill(dt)
 
           Me.DGVSearch.DataSource dt
        End Using
    End Sub


    Private Sub btnSearch_Click
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnSearch.Click

        Using da 
As New OleDbDataAdapter(sqlcon)

 
           Dim w As New List(Of String)

 
           ''  البحث عن التاريخ
            
'If txtStartDate.Text <> "" Then
            ' 
   sb.Append("[start] >= @start")
 
           '    da.SelectCommand.Parameters.AddWithValue("@start", txtStartDate.Text)
            '
End If

 
           ''  البحث عن التاريخ
            
'If txtEndDate.Text <> "" Then
            ' 
   sb.Append("[end] <= @end")
 
           '    da.SelectCommand.Parameters.AddWithValue("@end", txtEndDate.Text)
            '
End If


 
           If ComboBox1.Text <> "" Then
                w
.Add("[City] = @city")
 
               da.SelectCommand.Parameters.AddWithValue("@city"ComboBox1.Text)
 
           End If

 
           If ComboBox2.Text <> "" Then
                w
.Add("[Region] = @region")
 
               da.SelectCommand.Parameters.AddWithValue("@region"ComboBox2.Text)
 
           End If

 
           'If ComboBox3.Text <> "" Then
            ' 
   w.Add("[Nod] = @nod")
 
           '    da.SelectCommand.Parameters.AddWithValue("@nod", ComboBox3.Text)
            '
End If

 
           If ComboBox4.Text <> "" Then
                w
.Add("[FON] = @fon")
 
               da.SelectCommand.Parameters.AddWithValue("@fon"ComboBox4.Text)
 
           End If

 
           If w.Count 0 Then
                da
.SelectCommand.CommandText sql " WHERE " String.Join(" AND "w)
 
           End If

 
           Dim dt As New DataTable
            da
.Fill(dt)

 
           Me.DGVSearch.DataSource dt

        End Using

    End Sub


    Private Sub btnReset_Click
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnReset.Click

        Using da 
As New OleDbDataAdapter(sqlcon)
 
           Dim dt As New DataTable
            da
.Fill(dt)
 
           Me.DGVSearch.DataSource dt
        End Using

        ComboBox1
.Text = ("")
 
       ComboBox2.Text = ("")
 
       ComboBox3.Text = ("")
 
       ComboBox4.Text = ("")

 
   End Sub


End 
Class 

لا يوجد عمود باسم Nod لهذا تم تعطيل جزء البحث الخاص به




مشكووووووووووووووووور أخي الحبيب

تسلم ايديك و بارك الله فيك
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم