public UserInfo(DepInfo dep, string name, string post_name) { m_Uid = Guid.NewGuid().ToString(); m_Dep = dep; m_Name = name; m_PostName = post_name; m_DepUid = dep.Uid; }
public static void DeleteDepQuery(DepInfo depInfo, string connection_string) { MySqlConnection conn = new MySqlConnection(connection_string); // conn.Open(); MySqlCommand command = new MySqlCommand(); command.Connection = conn; command.CommandText = "delete from departments where id=" + depInfo.Id_InDb.ToString() + ";"; // byte[] databuff = ObjectToByteArray(depInfo); // MySqlParameter fileContentParameter = new MySqlParameter("?databuff", MySqlDbType.Blob, databuff.Length); // fileContentParameter.Value = databuff; // command.Parameters.Add(fileContentParameter); conn.Open(); command.ExecuteNonQuery(); }
public static void InsertDepQuery(DepInfo depInfo, string connection_string) { MySqlConnection conn = new MySqlConnection(connection_string); // conn.Open(); MySqlCommand command = new MySqlCommand(); command.Connection = conn; command.CommandText = "INSERT INTO departments (depInfo) VALUES (?databuff);"; byte[] databuff = ObjectToByteArray(depInfo); MySqlParameter fileContentParameter = new MySqlParameter("?databuff", MySqlDbType.Blob, databuff.Length); fileContentParameter.Value = databuff; command.Parameters.Add(fileContentParameter); conn.Open(); command.ExecuteNonQuery(); }