Click here to Skip to main content
15,906,285 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to get register date
tablename User

ID            int
Email         varchar(500)
Password       varchar(500)
Name            varchar(500)
Country        varchar(500)
LastLogin            datetime
RegisterDate         datetime
Description          Varchar(500)
ImageName           varchar(500)

C#
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();

what logic i use



    dbClass.ConnectDataBaseToInsert(que);
Posted
Updated 24-Apr-11 3:48am
v2
Comments
Sandeep Mewara 24-Apr-11 13:43pm    
You paste same type of question again and again. Further you fail to elaborate what is the issue.

Please try to DEBUG, see things, try to resolve and be clear on the issues.

Try dis

Session["UserId"] = dt.Rows[0].ItemArray[1].ToString();
Session["RegDate"] = dt.Rows[0].ItemArray[6].ToString();
 
Share this answer
 
Comments
ambarishtv 24-Apr-11 10:06am    
Session["UserId"] = dt.Rows[0]["Id"].ToString(); is wrong
To get RegisterDate type

// Get RegisterDate from row 0, column: RegisterDate
DateTime registerDate = (DateTime)dt.Rows[0]["RegisterDate"];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900