如何从asp.net(C#)中的数据库表数据中比较日期 [英] how to compare date from database table data in asp.net(C#)
本文介绍了如何从asp.net(C#)中的数据库表数据中比较日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尊敬的先生/妈妈
我是.net中的shailendra singh新手.我不解决问题.如何匹配数据库表中的日期日期和文本日期.怎么可能.但是现在我正在使用以下查询和代码按钮单击.
Dear sir/mam
I am shailendra singh new in .net . I don''t solve problem . How can match date database table date and text date . how can possible .But now I am using following query and code button click .
Da = new SqlDataAdapter("select * from tblorder where bookingdate=''txtform.text''",con1);
DataTable dt = new DataTable();
Da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
推荐答案
您应使用SqldataReader
You should use SqldataReader
SqlCommand cmd = new SqlCommand("select * from Table1",conObject);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
if (TextBox1.Text == dr.GetString(0)) // 0 is 1st column
{
//Do as your wish
}}
我忘了引用引号了:
I forget to mention quotes:
Da = new SqlDataAdapter("select * from tblorder where bookingdate=''" + txtform.text + "''",con1);
这篇关于如何从asp.net(C#)中的数据库表数据中比较日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文