Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionFor i As Integer = 0 To GridView5.DataRowCount - 1 'dts.Clear() sql = "select SV_Formation.* from SV_Formation where " If GridView5.GetRowCellValue(i, "Formateur").ToString <> "" Then sql = sql & "Formateur = '" & GridView5.GetRowCellValue(i, "Formateur").ToString & "' and " Try Dim date1 As Date date1 = CDate(GridView5.GetRowCellValue(i, "date_Formation").ToString) If date1.ToString = 10 Then sql = sql & " Date_Formation = '" & date1 & "' and " Catch ex As Exception End Try sql = sql & "ID > 0" cnx = Nothing cmd = Nothing dr = Nothing Try cnx = New SqlConnection(conn) cmd = New SqlCommand(sql, cnx) ' Ouvrir la connexion cnx.Open() dr = cmd.ExecuteReader() If dr.HasRows Then MessageBox.Show("BLA BLA BLA", "Message d'infos....", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If Catch ex As Exception MessageBox.Show(ex.Message) Finally If Not (dr Is Nothing) Then dr.Close() If Not (cnx Is Nothing) Then cnx.Close() End Try Next
If date1.ToString = 10 Then
"30/01/2020"pas 10, en plus 10 c'est un Integer que tu compares à une string.
If date1.ToString = 10 Then