Archive |
News - |
I have done an online users application to get online users by a method taken by the old classic ASP. Step:
online table CREATE TABLE online ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , nick VARCHAR( 10 ) , lastlogin VARCHAR( 45 ) NOT NULL ); then string quo = "INSERT INTO online(nick, lastlogin) VALUES (?nick, ?lastlogin)"; MySqlCommand mcommuo = new MySqlCommand(quo, mc); mcommuo.Parameters.AddWithValue("?nick", Request.Cookies["ut"].Value); mcommuo.Parameters.AddWithValue("?lastlogin", Convert.ToString(DateTime.Now)); mcommuo.ExecuteNonQuery(); mc.Close(); string quo1 = "SELECT DISTINCT nick FROM online WHERE lastlogin>'"+Convert.ToString(DateTime.Now.AddMinutes(-2))+"'"; MySqlCommand mcommuo1 = new MySqlCommand(quo1, mc); //MySqlDataReader mdruo = mcommuo1.ExecuteReader(); In this code I update the users updating lastlogin field, and retrieve them by a query. Here is the code onlineusers.txt |
Login or Register |
Information of Blog |
Home |
Welcome all!! |
Last Posts |
Categories | |
classic ASP (2) | |
DotNET (3) |