تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مساعدة في البحث في الداتا جريد فيو
#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 لهذا تم تعطيل جزء البحث الخاص به




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

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


الردود في هذا الموضوع
RE: مساعدة في البحث في الداتا جريد فيو - بواسطة khaled12345 - 10-05-17, 11:17 AM


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


يقوم بقرائة الموضوع: