User datenbank verknüpft

This commit is contained in:
2026-08-20 15:59:54 +02:00
parent 279ea709cd
commit 76b757a85c
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -31,6 +32,21 @@ namespace Casino
// execute the command and read the results
using MySqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
User u = new User(myReader.GetString("name"), myReader.GetInt32("age"), myReader.GetString("passwort"))
{
ID = myReader.GetString("id"),
Name = myReader.GetString("name"),
Alter = myReader.GetInt32("age"),
Passwort = myReader.GetString("passwort"),
Geld = myReader.GetInt32("geld")
};
user.Add(u);
}
myConnection.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)