Datapicker Mysql

0

How do I get the value that is in the datepicker and do a search in the database? I tried this way but this is not correct

var cmd = new MySqlCommand("SELECT distinct id, Pedagio, Carro, Placa, Fabricante, Ano, Cor, Data FROM tcc WHERE Data = '" + txtDate.Date + "'", _connection);

It was without the name I put it now, but it still does not take action.

<DatePicker x:Name="txtDate" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="0,208,0,0" VerticalAlignment="Top" Width="415">
    
asked by anonymous 06.04.2017 / 14:33

2 answers

1

Look for the Date property value in this control.

var cmd = new MySqlCommand("SELECT distinct id, Carro, Placa, Fabricante, Ano, Cor, Data   
FROM Novo WHERE Data = '"+ DatePicker.Date +"'", _connection);
    
06.04.2017 / 14:38
2

var cmd = new MySqlCommand ("SELECT distinct id, Car, Board, Manufacturer, Year, Color, Date FROM New WHERE Data = '" + DatePicker + "'", _connection) p>

Instead of WHERE is WHARE, check if that is not

    
06.04.2017 / 16:00