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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Module EDDYPHAN
Public BD As New SqlConnection
Public stcon, dada, list As String
Public Ji, Mi, Ai As String
'Public Mi As Date
Public NATPATH As String
Public loginpastor As String
Public nb As Integer
Public avi As String
Public An, Mo, Jo As Date
Public n, pt As Integer
Public datfin, datvali, eche As Date
Public vdate1, vdate2, vdate3 As Date
Public Kar, Del As String
Public SMenu, ty As String
Public formName As Object
Public z As Integer = 0
Public frmSit As New RptSit
Public etsit As New etcli
Public DARE, daPepe, dacbo, daco, dato, daeche, dafac As SqlDataAdapter
Public DSRE, dspepe, dscbo, dsco, dsto, dseche, dsfac As New DataSet
Public fin, fin1 As Integer
Public modi As Boolean
Public T1, T2, T3, TD, TCR, TCT, TK, LV, LC, LR, Aho As Decimal
Public etatcli As New FichCli
Public cac As New RPTFvb
Public etatc As New ActCredit
Public i As Integer
Public eddy As SqlCommand
Public CMUP As SqlCommandBuilder
Public daro As DataRow
Public dela As Integer = 10
Public listc As String
Public Sub CONNEXION()
MsgBox("A")
Dim sw As New StreamReader(Application.StartupPath + "\connexe.txt")
If File.Exists(Application.StartupPath + "\connexe.txt") = False Then
NATPATH = ""
Else
NATPATH = sw.ReadLine
NATPATH = UCase(NATPATH)
End If
MsgBox(NATPATH)
BD = New SqlConnection("Data Source= " & NATPATH & ";PASSWORD = secundia84;Integrated Security =SSPI; Persist Security Info =True;user ID =sa;initial Catalog = SCREANCE; ")
With BD
Try
BD.Open()
MsgBox(BD.State)
'frconnexio.ShowDialog()
Catch ex As Exception
MsgBox("Serveur de Données mal configuré...")
MsgBox(Err.Description)
End Try
End With
End Sub
Sub Main()
'MsgBox("Sub")
'CONNEXION()
frconnexio.ShowDialog()
'daeche = New SqlDataAdapter("select * from ListEChe where DateEche < '" & Now.ToShortDateString & "' and optgere = 'False' and optaverti = 'False'", BD)
'daeche.Fill(dseche, "ListEChe")
'MsgBox(dseche.Tables("ListEChe").Rows.Count)
'If dseche.Tables("ListEChe").Rows.Count <> 0 Then
' If MsgBox("Il y a '" & dseche.Tables("ListEChe").Rows.Count & "' échéances à recouvrir ce jour. Voulez-vous les visualiser", MsgBoxStyle.YesNo) = vbYes Then
' 'MsgBox("Bravo")
' End If
'End If
'frconnexio.ShowDialog()
End Sub
Public Sub executerrequet(ByVal sql As String)
Dim myconnection As SqlConnection = BD
Dim Mycommand As SqlCommand = myconnection.CreateCommand()
Mycommand.CommandText = sql
Mycommand.ExecuteNonQuery()
myconnection.Close()
End Sub
Public Function resultatrequet(ByVal sql As String) As SqlDataReader
Dim myconnection As SqlConnection = BD
' myconnection.Open()
Dim myreader As SqlDataReader
Using Command As New SqlCommand(sql, myconnection)
Command.CommandType = CommandType.Text
myreader = Command.ExecuteReader(CommandBehavior.CloseConnection)
End Using
Return myreader
End Function
Public Function verifiedoublon(ByVal sql As String, ByVal numcol As Integer, ByVal champ As String) As Integer
Dim resultat As SqlDataReader
resultat = resultatrequet(sql)
Dim touve As Boolean = 0
Do While resultat.Read
If champ = resultat(numcol) Then
touve = -1
Exit Do
End If
Loop
Return touve
End Function
Public Sub remplircombo(ByVal rqt As String, ByVal cbo As ComboBox)
Dim reader As SqlDataReader = resultatrequet(rqt)
Do While reader.Read
cbo.Items.Add(reader(0))
Loop
End Sub
End Module |
Partager