public void GetFace(string name) { using (var Connection = new MySqlConnection(connectionString)) { Connection.Open(); try { using (MySqlCommand selectcommand = Connection.CreateCommand()) { selectcommand.CommandText = "select columnname from tablename"; using (MySqlDataReader reader = selectcommand.ExecuteReader()) { var Names_list = new List<string>(); while (reader.Read()) { Names_list.Add(name); Attendance(Names_list.ToArray()); // it is a method which has a string[] paramater } } } } catch (Exception ex) { ex.Message.ToString(); } } }
private void Attendance(string[] name) { using (var Connection = new MySqlConnection(connectionString)) { Connection.Open(); try { DateTime CurrentDate; CurrentDate = DateTime.Now; using (MySqlCommand selectcommand = Connection.CreateCommand()) { selectcommand.CommandText = "UPDATE tablename SET " + CurrentDate.ToString("MM_dd_yyyy") + " = '" + CurrentDate + "' WHERE columnname = '" + name + "'"; selectcommand.ExecuteNonQuery(); } } catch (Exception ex) { ex.Message.ToString(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)