DatenBank verbindung erstellung

This commit is contained in:
younes elhaddoury
2026-01-30 09:40:31 +01:00
parent 3b739592a0
commit d9b51b4629
2 changed files with 21 additions and 33 deletions

View File

@@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace SkyTeam
{
internal class DataBase
{
private string mySqlConnectionString = "Server=mysql.pb.bib.de;uid=pbt3h24akh;pwd=Dd3dwQgPeNxW;database=pbt3h24akh_SkyTeam;";
public bool TestConnection()
{
try
{
using (var conn = new MySqlConnection(mySqlConnectionString))
{
conn.Open(); // versuchen, die Verbindung zu öffnen
Console.WriteLine("Verbindung erfolgreich!");
return true;
}
}
catch (MySqlException ex)
{
Console.WriteLine("Verbindungsfehler: " + ex.Message);
return false;
}
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SkyTeam
{
class DatenbankServices
{
private string ConnectionString = "Server=mysql.pb.bib.de;uid=pbt3h24akh;pwd=Dd3dwQgPeNxW;database=pbt3h24akh_SkyTeam;";
protected virtual string connectionString
{
get { return ConnectionString; }
private set { ConnectionString = value; }
}
}
}