Bild aus datenbank hinzufügen
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user