-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchPloio.xaml.vb
93 lines (87 loc) · 3.32 KB
/
searchPloio.xaml.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Imports System.Data.SqlClient
Imports System.Data
Public Class searchPloio
Dim mastercon As New appInfo
Dim mycon As String = mastercon.sqlCon
Dim db As String = mastercon.database
Dim con As New SqlConnection
Public Sub startApp()
fillCombo()
End Sub
Public Sub fillCombo()
Try
Dim reader As SqlDataReader
con.ConnectionString = mycon
Dim sqlCMD As New SqlCommand("select * from " & db & ".eidosAkinisias", con)
con.Open()
' ***EKTELESH QUERY ARXH
reader = sqlCMD.ExecuteReader()
While reader.Read
eidosAkinisiaCombo.Items.Add(reader.Item("eidosAkinisias"))
End While
reader.Close()
con.Close()
Catch ex As Exception
con.Close()
MsgBox("fillcombo--insertPloio-1-" & ex.Message)
Finally
con.Close()
End Try
Try
Dim reader As SqlDataReader
con.ConnectionString = mycon
Dim sqlCMD As New SqlCommand("select * from " & db & ".etosT", con)
con.Open()
' ***EKTELESH QUERY ARXH
reader = sqlCMD.ExecuteReader()
While reader.Read
etosCombo.Items.Add(reader.Item("eetos"))
End While
reader.Close()
con.Close()
Catch ex As Exception
con.Close()
MsgBox("fillcombo--insertPloio-2-" & ex.Message)
Finally
con.Close()
End Try
End Sub
Public Sub searchData()
Try
Dim apoDate As New Date
Dim mexriDate As Date
If apodatePick.Text.Length > 0 Then
apoDate = apodatePick.Text
Else
apoDate = "1900-01-01"
End If
If mexridatePick.Text.Length > 0 Then
mexriDate = mexridatePick.Text
Else
mexriDate = "2100-01-01"
End If
Dim ploioDS As New DataSet
Dim ploioDA As New SqlDataAdapter
con.ConnectionString = mycon
Dim ploioCMD As New SqlCommand
ploioCMD.Connection = con
ploioCMD.CommandText = "select * from " & db & ".ploio4plate where onomaPloioy like '%" _
& onomaploioyText.Text.ToUpper & "%' and eidosAkinisias like '%" & eidosAkinisiaCombo.SelectedItem & "%' and etosAkinisias like '%" & etosCombo.SelectedItem & "%' and dateDB between '" _
& apoDate.ToString("yyyy-MM-dd") & "' and '" & mexriDate.ToString("yyyy-MM-dd") & "'"
ploioCMD.CommandType = CommandType.Text
ploioDA.SelectCommand = ploioCMD
ploioDA.Fill(ploioDS, "ploioRes")
con.Close()
Dim mm As MainWindow = Window.GetWindow(Me)
mm.bottomGrid.Children.Clear()
Dim getdata As New dataControl
getdata.showDataPloio(ploioDS.Tables(0))
mm.bottomGrid.Children.Add(getdata)
'For Each dataPloio As DataRow In ploioDS.Tables(0).Rows
' MsgBox(dataPloio("idPloio"))
'Next
Catch ex As Exception
MsgBox("searchData---" & ex.Message)
End Try
End Sub
End Class