为什么 我不能使用datetimepicker的属性啊DateTime dateTimePicker1 = dateTimePicker1.Text; ; 显示 Text 5
namespace图书管理系统{publicpartialclassLendStatistics:Form{publicLendStatistics(){Initiali...
namespace 图书管理系统
{
public partial class LendStatistics : Form
{
public LendStatistics()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DateTime dateTimePicker1 = dateTimePicker1.Text; ;
DateTime dateTimePicker2 = dateTimePicker2.Text;
SqlConnection conn = new SqlConnection(" integrated security=True; data source=.; database=DBLibrary");
conn.Open();
string str = " select rdID as 读者证号,bkName,书名 ,bkCode as 书号,from Borrow from Books join Borrow on (Books.bkCode=Borrow.bkCode) where DateLend between dateTimePicker1 and dateTimePicker2 ";
SqlDataAdapter adapter = new SqlDataAdapter(str, conn);
DataTable tb = new DataTable();
adapter.Fill(tb);
dataGridView1.DataSource = tb;
conn.Close();
}
}
} 展开
{
public partial class LendStatistics : Form
{
public LendStatistics()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DateTime dateTimePicker1 = dateTimePicker1.Text; ;
DateTime dateTimePicker2 = dateTimePicker2.Text;
SqlConnection conn = new SqlConnection(" integrated security=True; data source=.; database=DBLibrary");
conn.Open();
string str = " select rdID as 读者证号,bkName,书名 ,bkCode as 书号,from Borrow from Books join Borrow on (Books.bkCode=Borrow.bkCode) where DateLend between dateTimePicker1 and dateTimePicker2 ";
SqlDataAdapter adapter = new SqlDataAdapter(str, conn);
DataTable tb = new DataTable();
adapter.Fill(tb);
dataGridView1.DataSource = tb;
conn.Close();
}
}
} 展开
2个回答
展开全部
不应该使用dateTimePicker的Text属性,而是value属性
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询