60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace StacjaProb
|
|
{
|
|
public partial class MySQLServerConfigForm : Form
|
|
{
|
|
public MySQLServerConfigForm()
|
|
{
|
|
InitializeComponent();
|
|
inPasword.MaxLength = 32;
|
|
inPasword.PasswordChar = '*';
|
|
|
|
}
|
|
|
|
private void MySQLServerConfigForm_Load(object sender, EventArgs e)
|
|
{
|
|
inHostName.Text = vGlobal.vMySql_hostname;
|
|
inUserName.Text = vGlobal.vMySql_user;
|
|
inPasword.Text = vGlobal.vMySql_pass;
|
|
inDbName.Text = vGlobal.vMySql_dbname;
|
|
|
|
}
|
|
|
|
private void inButtonOK_Click(object sender, EventArgs e)
|
|
{
|
|
const string userRoot = "HKEY_CURRENT_USER\\SoftSPM";
|
|
|
|
vGlobal.vMySql_hostname = inHostName.Text;
|
|
vGlobal.vMySql_dbname = inDbName.Text;
|
|
vGlobal.vMySql_user = inUserName.Text;
|
|
vGlobal.vMySql_pass = inPasword.Text;
|
|
|
|
Microsoft.Win32.Registry.SetValue(userRoot + "\\SPM_TST", "HOST_NAME", inHostName.Text);
|
|
Microsoft.Win32.Registry.SetValue(userRoot + "\\SPM_TST", "DB_USER", inUserName.Text);
|
|
Microsoft.Win32.Registry.SetValue(userRoot + "\\SPM_TST", "DB_USER_PASSWORD", inPasword.Text);
|
|
Microsoft.Win32.Registry.SetValue(userRoot + "\\SPM_TST", "DB_NAME", inDbName.Text);
|
|
|
|
mySqlFunctions.initConnection();
|
|
if (!mySqlFunctions.OpenConnection())
|
|
MessageBox.Show("Problem z połączeniem z bazą danych");
|
|
else
|
|
{
|
|
mySqlFunctions.CloseConnection();
|
|
//ReadWriteFile.SaveDbAccessConfig();
|
|
|
|
this.Close();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|