dear all,
i am searching for a date in sqlserver in asp.net 2.0.
string curdate = DateTime.Now.ToShortDateString();//03/10/2008
SqlDataSource2.SelectCommand = "Select * from Expenditure_Det where Exp_Date >= '"+curdate +"'";--Problem in casting a string to datetime.
how to convert curdate to a shortdate again to 03/10/2008 for searching in a table...
AMR
Blocked AccountPosted Mar 11, 2008, 5:34 AM
U can do this by using this code
string curdate = DateTime.Now.ToShortDateString() // Convert DateTime into string
DateTime dtVar = Convert.ToDateTime(curdate); // Convert string into DateTime
Happy Coding!!