【发布时间】:2013-04-14 06:31:26
【问题描述】:
我想在我的 ado.net 应用程序中的标签中显示生日提醒。
我怎样才能证明这一点?
我只想在我的字段name、id、DateOfBirth 和他的数据类型为Datetime 值以mm/dd/yyyy 格式存储在该字段中的值。
请帮助我这对我的项目非常重要
我写了一个查询,但没用:
select PationName,ContactNo
from Physio_cureTable
where DateOfBirth between getdate()-1
and getdate()
iam 在我的 ado.net 应用程序中写了下面的代码,但它给了我空白数据,我检查输入今天的日期和月份,然后也显示空白数据
string result = "SELECT PationName FROM Physio_cureTable WHERE CAST(DateOfBirth AS DATETIME)=CAST(GETDATE() AS DATETIME)";
SqlCommand showresult = new SqlCommand(result, con);
con.Open();
string actresult =(string) showresult.ExecuteScalar();
con.Close();
if (!string.IsNullOrEmpty(actresult))
label18.Text ="Happy Birthday"+actresult+"!";
else
label18.Text = "There is No Birthday!!";
【问题讨论】:
标签: sql sql-server sql-server-2005 ado.net