伊植美1280的体验卡:asp.net讲字符串转成datetime型

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 06:49:34
在asp.net中,如何将一个字符串转成datetime型呢?
string a=TextBox1.Text.ToString();
Date b=Cdate('a');
string scalarQueryStr="select count(*) from GovFile where ReleaseDate.Date=b";
以上是我的代码,可出错提示是:找不到类型或命名空间名称date?
急啊

string a=TextBox1.Text.Trim();
DateTime b = DateTime.Parse(a);
string scalarQueryStr="select count(*) from GovFile where ReleaseDate.Date=b";
.NET里没有你所用到的Date类,所以找不到.DateTime才对.另外我帮你改了下你的代码,更科学了些:)