string chkUser = "Select * FROM [User] where Email='" + UserName + "' AND Password='" + Password + "'"; dt = dbClass.ConnectDataBaseReturnDT(chkUser); if (dt.Rows.Count > 0) { boolReturnValue = true; Session["UserId"] = dt.Rows[0]["Id"].ToString(); string que = "UPDATE [User] SET LastLogin = GETDATE() where Id=" + Session["UserId"].ToString(); DateTime registerDate = (DateTime)dt.Rows[0]//specified cast is not ["RegisterDate"];valid dbClass.ConnectDataBaseToInsert(que); } return boolReturnValue; }
DateTime registerDate = (DateTime)dt.Rows[0]//specified cast is not ["RegisterDate"];valid
DateTime registerDate = (DateTime)dt.Rows[0]["RegisterDate"];
DateTime temp; if(DateTime.TryParse(dt.Rows[0].ItemArray[6].toString(), out temp)) { //Valid date } else { //Invalid date }
dt.Rows[0]
Session["UserId"]
registerDate
DateTime.Parse()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)