Skip to content

Instantly share code, notes, and snippets.

@jtuttas
Last active September 26, 2016 13:55
Show Gist options
  • Save jtuttas/5964660 to your computer and use it in GitHub Desktop.
Save jtuttas/5964660 to your computer and use it in GitHub Desktop.
Ausnahmebehandlung mit Datenbank
#Datenbank Ausnahmebahandlung
$ok=$false
do {
try {
$connString = "Server=localhost;Uid=tuttas;Pwd=joerg123;database=wol";
# load MySQL driver and query database
[void][system.reflection.Assembly]::LoadFrom("MySQL.Data.dll");
$conn = New-Object MySql.Data.MySqlClient.MySqlConnection;
$conn.ConnectionString = $connString;
$conn.Open();
$ok=$true;
}
catch {
. $PSScriptRoot\Config.ps1
$ok=$false
}
}
while ($ok -eq $false)
@jkroepke
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment