Dim oConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=""C:\a.mdb""") Dim oCmd As OleDbCommand = oConn.CreateCommand() oCmd.CommandText = "SELECT COUNT(0) FROM `Matériel` WHERE `Date_achat`>=#" & DateTimePicker1.Value.ToString("yyyy-MM-dd") & "# " oConn.Open() With oCmd.ExecuteReader() .Read() TextBox1.Text = .GetValue(0).ToString() .Close() End With oConn.Close()
Dim oConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=""C:\a.mdb""") Dim oCmd As OleDbCommand = oConn.CreateCommand() oCmd.CommandText = "SELECT COUNT(0) FROM `Matériel` WHERE `Date_achat`>=p1 " oCmd.Parameters.Add("p1", OleDbType.DBDate).Value = DateTimePicker1.Value oConn.Open() With oCmd.ExecuteReader() .Read() TextBox1.Text = .GetValue(0).ToString() .Close() End With oConn.Close()
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question