| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- 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;
- using Npgsql;
- namespace pract
- {
- public partial class Form2 : Form
- {
- public Form2()
- {
- InitializeComponent();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- string dbUser = textBox1.Text;
- string password = textBox2.Text;
- var connString = "Host=80.250.189.52;Database=dbwork;Username=goreva_am;Password=qm#J6pyA%K#;";
- try
- {
- using (var conn = new NpgsqlConnection(connString))
- {
- conn.Open();
- }
- var isAdmin = ("goreva_am" == textBox1.Text);
- Form1 form1 = new Form1(connString, isAdmin);
- form1.ShowDialog();
- }
- catch (Exception ex)
- {
- MessageBox.Show("Ошибка подключения к БД: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- }
|