Bild aus datenbank hinzufügen

This commit is contained in:
2026-09-01 10:31:05 +02:00
parent 83e0119ad4
commit b1c54aeda0
5 changed files with 69 additions and 14 deletions
+24
View File
@@ -56,5 +56,29 @@ namespace Casino
return user;
}
public byte[] GetCardImage(int id)
{
byte[] imageBytes = null;
using (MySqlConnection conn = new MySqlConnection(myConnectionString))
{
conn.Open();
using (MySqlCommand cmd = new MySqlCommand("SELECT bild FROM Karten WHERE kartenid = @id", conn))
{
cmd.Parameters.AddWithValue("@id", id);
using (MySqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
imageBytes = (byte[])reader["bild"];
}
}
}
}
return imageBytes;
}
}
}