Last post Aug 19, 2013 03:51 AM by Amy Peng - MSFT
Aug 06, 2013 01:37 AM|vishnu.419|LINK
A website which will store the employee id in sql table when employee enters the id first time.....
and next time when employee enters his id first time in textbox in website in a day ,it needs to store the employee entry time(in time)....
and in the same day...when he enters the same id ,it needs to store the out time of employee....
finally the whole data i.e date,intime,outtime,id has to store in database everyday......
and other requirment is the admin with some other id can see the total employee timings according to date wise in gridview
Aug 06, 2013 01:47 AM|ramu.net|LINK
Create a table with name "User_Login_Log" with columns UserID, Login_date, Logout_date.
when employee enters his id first time in textbox in website in a day
insert his login_date in table.
he same day when he enters the same id update table with Logout_date.
Hope you understand.
Aug 06, 2013 01:53 AM|vishnu.419|LINK
i need to store login/logout timings in a day and as well as dates
please give me suggetions .......
Thanks in advance......
Aug 19, 2013 03:51 AM|Amy Peng - MSFT|LINK
You can store the login/logout time as following, and I use the login time as an example:
protected void loginButton_Click(object sender, EventArgs e)
Boolean validUser = false;
string displayname = TextBox1.Text.Trim() ;
string password = TextBox2.Text.Trim();
SqlConnection connection = null;
SqlCommand command = null;
SqlDataReader dataReader = null;
string connectionString = ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString;
connection = new SqlConnection(connectionString);
//prepare sql statements
string sql = "SELECT * from Member where name='" + name + "' And Password='" + password + "'";
command = new SqlCommand(sql, connection);
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
if (dt.Rows.Count > 0)
/* add value to Session */
Session["displayName"] = displayname;
validUser = true;
/* Logging Information to Logtable */
command = new SqlCommand("insert into LogTableName(name,logintime) values(@name,@logintime)", connection);
/* Redirect user to Home Page */
catch (Exception ex)