04-06-22, 11:26 AM
يسعد اوقاتكم جميعا انا استخدم vb2010 مع قاعدة بيانات اكسس .... اذا سمحتو مساعدة بخصوص البحث عن نص معين بين تاريخين اذا سمحتو المقصود اريد البحث عن عدد اجازات الموظف x بين تاريخ 1 وتاريخ 2
Dim str As String = "select * from TBLE where Jobs like '%" & TextBox1.Text & "%' or Ctest like '%" & TextBox1.Text & "%' and Date1 between #" & TextBox2.Text & "# And #" & TextBox3.Text & "#" Dim str As String = "select * from TBLE where Uname like '%" & TextBox1.Text & "%' and Date1 between #" & TextBox2.Text & "# And #" & TextBox3.Text & "#"Dim str As String = "select * from TBLE where Uname like '%" & TextBox1.Text & "%' and Date1 between #" & TextBox2.Text & "# And #" & TextBox3.Text & "# order by ID"
Dim str2 As String = "select * from TBLE where Uname like '%" & TextBox1.Text & "%' order by ID"
Dim STR3 As String = "SELECT * from TBLE"
If RadioButton1.Checked = True Then
DataGridView1.DataSource = GetTable(str2)
ElseIf RadioButton2.Checked = True Then
DataGridView1.DataSource = GetTable(str)
ElseIf TextBox1.Text = Nothing Then
DataGridView1.DataSource = GetTable(STR3)
End If![[صورة مرفقة: 165433765740692.png]](https://up6.cc/2022/06/165433765740692.png)
![[صورة مرفقة: 165433765736161.png]](https://up6.cc/2022/06/165433765736161.png)
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
DataGridView1.DataSource = SelectBetweenVB(DateTimePicker1.Value, DateTimePicker2.Value, 1626)
End Sub
Private Function SelectBetweenVB(Date1 As DateTime, Date2 As DateTime, EmpID As Integer) As DataTable
Dim StrSQL As String = "Select * FROM EmpTbl Where Tdata BETWEEN #" & Date1.ToString("yyyy-MM-dd") & "# and #" & Date2.ToString("yyyy-MM-dd") & "# and EmpID=" & EmpID
Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\AsemXP\Desktop\Test.accdb;Jet OLEDB:Database Password=;")
Dim da As New OleDbDataAdapter(StrSQL, cn)
Dim dt As New DataTable
da.Fill(dt)
Return dt
End Function