public object[] ScoreFill(object[] ojc, int n) { DBfunk dbClass = new DBfunk(); using (var conn = dbClass.Score()) { ListBox ls = new ListBox(); ls.Items.AddRange(ojc); // conn.Parameters.AddWithValue("@MemberNr", text); var data = ls.Items.OfType <string>().Select(line => line.Split(new char[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries)) .Select(items => new { PlayerNrL = items[0], Vorname = items[1], Nachname = items[2], }); int b = 0; foreach (var item in data) { if (n == b) { conn.Parameters.AddWithValue("@PlayerNr", SqlDbType.NVarChar).Value = item.PlayerNrL; conn.ExecuteNonQuery(); break; } else { b++; } } object[] objCollection = new object[ls.Items.Count]; ls.Items.CopyTo(objCollection, 0); return(objCollection); } }
public DataTable Befor() { DBfunk dbClass = new DBfunk(); using (var conn = dbClass.LoadMem()) { DataTablesFun dataTablesFunktions = new DataTablesFun(); SqlDataReader reader; reader = conn.ExecuteReader(); DataTable dt = dataTablesFunktions.dt(); dt.Load(reader); return(dt); } }
public object[] Fore2() { DBfunk dbClass = new DBfunk(); using (var conn = dbClass.LoadMem()) { SqlDataReader reader; reader = conn.ExecuteReader(); var Listt = new ListBox(); while (reader.Read()) { Listt.Items.Add(reader[3].ToString() + " " + reader[1].ToString() + " " + reader[2].ToString()); } object[] objCollection = new object[Listt.Items.Count]; Listt.Items.CopyTo(objCollection, 0); return(objCollection); } }
public bool UsernameCheck(string Nummer) { bool isUserExisted = false; DBfunk DBfunk = new DBfunk(); SqlCommand cmd = DBfunk.NumberCheck(); cmd.Parameters.AddWithValue("@PlayerNr", Nummer); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { if (dr.HasRows == true) { isUserExisted = true; break; } } return(isUserExisted); }
public object[] Fore3(string text) { DBfunk dbClass = new DBfunk(); using (var conn = dbClass.SerMembr()) { conn.Parameters.AddWithValue("@PlayerNr", text); SqlDataReader reader; reader = conn.ExecuteReader(); var Listt = new ListBox(); while (reader.Read()) { Listt.Items.Add(reader[3].ToString() + " " + reader[1].ToString() + " " + reader[2].ToString()); } object[] objCollection = new object[Listt.Items.Count]; Listt.Items.CopyTo(objCollection, 0); return(objCollection); } }
public void User(string Name, string Surname, string Nummer) { DBfunk dbClass = new DBfunk(); using (var conn = dbClass.newMemb()) { conn.Parameters.AddWithValue("@Name", Name); conn.Parameters.AddWithValue("@Surname", Surname); bool isUserExisted = UsernameCheck(Nummer); if (isUserExisted) { MessageBox.Show("MitgliedNr ist Vergeben"); } else { conn.Parameters.AddWithValue("@PlayerNr", Nummer); conn.ExecuteNonQuery(); } } }