none
sql veri çekmek RRS feed

  • Soru

  • string tablo = RaporSec.Text;
                    string sorgu = $@"SELECT * FROM {tablo} Where LocalCol>= @baslangic and @baslangicsaati and LocalCol < @bitis and @bitissaati";
                    var tbl = new System.Data.DataTable();
                    var adapter = new SqlDataAdapter(sorgu, baglanti.ConnectionString);
                    adapter.SelectCommand.Parameters.Add("@baslangic", SqlDbType.Date).Value = BaslangicZamani.Value.Date;
                    adapter.SelectCommand.Parameters.Add("@baslangicsaati", SqlDbType.Date).Value = BaslangicSaati.Value.Hour;
                    adapter.SelectCommand.Parameters.Add("@bitis", SqlDbType.Date).Value = BitisZamani.Value.Date.AddDays(1);
                    adapter.SelectCommand.Parameters.Add("@bitissaati", SqlDbType.Date).Value = BitisSaati.Value.AddHours(1);
                    adapter.Fill(tbl);

                    dataGridView1.DataSource = tbl;

    tarih aralığında alıyorum ama saat arılığında alamıyorum

    16 Ekim 2019 Çarşamba 20:32

Yanıtlar