C# Access Veri Tabani ile Tarih Sorgulama

SqlCommand cmd = new SlqCommand ("SELECT * FROM tabloadi WHERE tarih=#" + dateTimePicker1.Value.ToString("yyyy/MM/dd").Replace('.', '/') + "#",MyConnection);
DateTimePicker objesinden gelen veriye gore veri tabanimizdan tarih sorgulatmayi bu sekilde yapabiliriz.

Tabii ki tavsiye edilen sekli ve daha basitlestirilmis hali ise parametre kullanilarak yapmaktir.


SqlCommand cmd = new SlqCommand ("SELECT * FROM tabloadi WHERE tarih=@tarih",MyConnection);
cmd.Parameters.AddWithValue("@tarih", dateTimePicker1.Value.ToString("yyyy/MM/dd"));

Yayınlanan <a href="https://www.mahmuttalhakoz.com/blog/index.php/category/csharp/" rel="category tag">C#</a> Takip edilen <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/c/" rel="tag">c#</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/c-parameters/" rel="tag">c# parameters</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/c-parametre/" rel="tag">c# parametre</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/csharp-2/" rel="tag">csharp</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/datetimepicker/" rel="tag">datetimepicker</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/sorgulama/" rel="tag">sorgulama</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/tarih/" rel="tag">tarih</a>, <a href="https://www.mahmuttalhakoz.com/blog/index.php/tag/veritabani/" rel="tag">veritabani</a> Bir yorum yapın