From 32d51bd4325239484d869a243b44e7ea41eba200 Mon Sep 17 00:00:00 2001 From: "NBTEMP\\bib" Date: Wed, 19 Aug 2026 14:27:11 +0200 Subject: [PATCH] Datenbank verbindung eingerichtet --- Casino/Database.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Casino/Database.cs b/Casino/Database.cs index 0e96f17..55173ed 100644 --- a/Casino/Database.cs +++ b/Casino/Database.cs @@ -11,9 +11,9 @@ namespace Casino internal class Database { private string myConnectionString = "server=mysql.pb.bib.de;uid=pbg2h25ala;pwd=a7TP2aRv7Xdu;database=pbg2h25ala_Casino"; - public ObservableCollection SelectTask() + public ObservableCollection SelectTask() { - ObservableCollection taskList = new ObservableCollection(); + ObservableCollection user = new ObservableCollection(); try { @@ -25,24 +25,12 @@ namespace Casino // create a MySQL command and set the SQL statement with parameters MySqlCommand myCommand = new MySqlCommand(); myCommand.Connection = myConnection; - myCommand.CommandText = @"SELECT * FROM task"; + myCommand.CommandText = @"SELECT * FROM Nutzer"; // myCommand.Parameters.AddWithValue("@code", "12"); // execute the command and read the results using MySqlDataReader myReader = myCommand.ExecuteReader(); - while (myReader.Read()) - { - /*int id = myReader.GetInt32("id"); - int priority = myReader.GetInt32("priority"); - string title = myReader.GetString("title"); - double expense = myReader.GetDouble("expense"); - bool done = myReader.GetBoolean("done"); - Task t1 = new Task(id, priority, title, expense, done); - taskList.Add(t1); - Console.WriteLine($"ID: {id}, Priority: {priority}, Title: {title}, Expense: {expense}, Done: {done}");*/ - } - myConnection.Close(); } catch (MySql.Data.MySqlClient.MySqlException ex) @@ -50,6 +38,7 @@ namespace Casino Console.WriteLine(ex.Message); } + return user; } } }