本文介绍了如何在ado.net中的标签中显示生日提醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨所有
我想在我的ado.net应用程序中用标签显示生日提醒我该如何显示?我的字段名称ID DateOfBirth和他的数据类型是该字段中的日期值存储,以mm / dd / yyyy格式请帮助我对我的项目非常重要请
hi all
i want to show birthday alert in my ado.net application in label how can i show that? my field name id DateOfBirth and his datatype is Datetime value store in that field in mm/dd/yyyy format please help me its very important to my project please
推荐答案
con = new SqlConnection("Data Source=ADMIN\\SQLEXPRESS;Initial Catalog=PhysioCure; Integrated Security=true");
string result = "SELECT PationName FROM Physio_cureTable WHERE datepart(d, DateOfBirth) = datepart(d, getdate()) AND datepart(m, DateOfBirth) = datepart(m, getdate())";
SqlCommand showresult = new SqlCommand(result, con);
con.Open();
string actresult =(string) showresult.ExecuteScalar();
con.Close();
if (!string.IsNullOrEmpty(actresult))
label18.Text ="Happy Birthday \n"+actresult+"!!";
else
label18.Text = "There is No Birthday!!";
快乐编码
happy coding
这篇关于如何在ado.net中的标签中显示生日提醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!