123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.SqlClient;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Bronin_3
- {
- public partial class Form1 : Form
- {
- //string conn = @"Data Source=ZXCNUT\\SQLEXPRESS;Initial Catalog=user03;Integrated Security=True;Encrypt=False";
- // Временно измените строку подключения для проверки
- string conn = @"Data Source=ZXCNUT\SQLEXPRESS;Initial Catalog=user03;Integrated Security=True;";
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Close();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- AboutBox1 aboutBox1 = new AboutBox1();
- aboutBox1.ShowDialog(); // О программе
- }
- private void button3_Click(object sender, EventArgs e)
- {
- label1.Text = "nsdf";
- string query = @"SELECT * FROM [dbo].[EdenicaIzmereniya$]";
- using (SqlConnection connect = new SqlConnection(conn))
- {
- try
- {
- SqlDataAdapter ad = new SqlDataAdapter(query, connect);
- DataTable f = new DataTable();
- ad.Fill(f);
- dataGridView1.DataSource = f;
- }
- catch (Exception ex)
- {
- MessageBox.Show("Ошибка: " + ex.Message);
- }
- }
- }
- }
- }
|