Jo, konnte leider bei "Tools" nichts hochladen, sondern nur bei global "Downloads".
Ist simples, was dort ausgeführt wird:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace DB_Extern_Checker
{
public partial class DBChecker : Form
{
public DBChecker()
{
try
{
InitializeComponent();
lblDatabase.Visible = false;
lblResult.Visible = false;
lblResponse.Visible = false;
}
catch(Exception ex)
{
throw ex;
}
}
int changingtime = 0;
bool available = false;
private void btnReset_Click(object sender, EventArgs e)
{
try
{
tbHost.Text = "127.0.0.1";
tbUsername.Text = "Username";
tbPassword.Text = "********";
tbDatabase.Text = "amxbans";
tbPort.Text = "3306";
changingtime = 0;
tbPort.ReadOnly = false;
}
catch(Exception ex)
{
throw ex;
}
}
private void btnCheck_Click(object sender, EventArgs e)
{
try
{
btnCheck.Enabled = false;
btnReset.Enabled = false;
lblResult.Visible = false;
lblResponse.Visible = false;
lblDatabase.Visible = false;
string connectionString = "SERVER="+tbHost.Text+";" + "DATABASE="+tbDatabase.Text+";" + "UID="+tbUsername.Text+";" + "PASSWORD="+tbPassword.Text+";" + "PORT="+tbPort.Text+";";
MySqlConnection connection = new MySqlConnection(connectionString);
connection.Open();
available = true;
connection.Dispose();
connection.Close();
}
catch(Exception ex)
{
lblResponse.Visible = true;
lblResponse.Text = ex.Message.ToString();
available = false;
}
try
{
if (available == true)
{
lblDatabase.Visible = true;
lblResult.Visible = true;
lblResult.ForeColor = Color.Green;
lblResult.Font = new Font(lblResult.Font, FontStyle.Bold);
lblResult.Text = "Success";
}
else if (available == false)
{
lblDatabase.Visible = true;
lblResult.Visible = true;
lblResult.ForeColor = Color.Red;
lblResult.Font = new Font(lblResult.Font, FontStyle.Bold);
lblResult.Text = "Failure";
}
btnCheck.Enabled = true;
btnReset.Enabled = true;
}
catch(Exception ex)
{
throw ex;
}
}
private void tbPort_TextChanged(object sender, EventArgs e)
{
try
{
if (changingtime == 0)
{
DialogResult portChanged = MessageBox.Show("Are you sure what you are doing?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (portChanged == DialogResult.Yes)
{
changingtime = 1;
}
else if (portChanged == DialogResult.No)
{
tbPort.ReadOnly = true;
changingtime = 1;
tbPort.Text = "3306";
}
}
else if (changingtime == 1)
{
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
Zuletzt modifiziert von SeToY am 18.05.2010 - 09:07:15