[英]How to transfer data into a datagrid?
I defined a column in a database as yyyy/mm/dd hh:hh:hh
. 我在数据库中将列定义为
yyyy/mm/dd hh:hh:hh
。 Now , I want to transfer the data that I get from Visual Studio by between datetimepicker1
and datetimepicker2
to a datagridview
. 现在,我想将在
datetimepicker1
和datetimepicker2
之间从Visual Studio获得的数据传输到datagridview
。 Is there any way to do that? 有什么办法吗?
This is the code that I wrote but I get an error from this line: 这是我编写的代码,但此行出现错误:
adp = new SqlDataAdapter("select * from tablo where tablo.tarih >=
@StartDateTime AND tablo.tarih <= @EndDateTime", baglanti);
adp.SelectCommand.Parameters.AddWithValue("@StartDateTime",
Convert.ToDateTime(dtpBaslangic.Value));
adp.SelectCommand.Parameters.AddWithValue("@EndDateTime",
Convert.ToDateTime(dtpBitis.Value));
DataSet ds = new DataSet(); DataSet ds = new DataSet();
adp.Fill(ds); adp.Fill(DS);
dataGridView.DataSource = ds.Tables[0] dataGridView.DataSource = ds.Tables [0]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.