Beispiel #1
0
 private void ListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count > 0)
     {
         ListViewItem current = listView.SelectedItems[0];
         start       = (fingerdatabase)current.Tag;
         currentuser = start.username;
         currentid   = start.userid;
         currentscan = start.scanid;
     }
 }
        public static fingerdatabase insert(string user, string u)
        {
            List <fingerdatabase> me = new List <fingerdatabase>();
            string       y           = string.Format("INSERT INTO fingerdb(username,userid,scanid) VALUES('{0}','{1}','{2}')", user, u, "scan registered yet");
            MySqlCommand cmd         = new MySqlCommand(y, databaseconnection);

            databaseconnection.Open();
            cmd.ExecuteNonQuery();
            fingerdatabase open = new fingerdatabase(user, u, "scan registered yet");

            databaseconnection.Close();
            return(open);
        }
        public static List <fingerdatabase> GetFingerdatabases()
        {
            List <fingerdatabase> user = new List <fingerdatabase>();
            string       query         = "SELECT * FROM fingerdb";
            MySqlCommand cmd           = new MySqlCommand(query, databaseconnection);

            databaseconnection.Open();
            MySqlDataReader read = cmd.ExecuteReader();

            while (read.Read())
            {
                string         username = read["username"].ToString();
                string         userid   = read["userid"].ToString();
                string         scanid   = read["scanid"].ToString();
                fingerdatabase u        = new fingerdatabase(username, userid, scanid);
                user.Add(u);
            }
            databaseconnection.Close();
            return(user);
        }