Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 System.Data.SqlClient;
- namespace bd
- {
- public partial class Form1 : Form
- {
- private SqlConnection sqlConnection = null;
- private SqlDataAdapter adapter = null;
- private DataTable table;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- string ConnectionString = @"Data Source=xxx.xxx.xxx.xxx;Initial Catalog=db22204;User ID=User000;Password=**********;Integrated Security=False";
- sqlConnection = new SqlConnection(ConnectionString);
- sqlConnection.Open();
- adapter = new SqlDataAdapter("SELECT concat(txtClientSurname, ' ', txtClientName, ' ', txtClientSecondName) as 'ФИО клиента', intAccountTypeId as 'Тип счета', datAccountBegin as 'Дата открытия', txtAccountNumber as 'Номер счета' FROM tblAccount, tblClient WHERE tblAccount.intClientId = tblClient.intClientId", sqlConnection);
- table = new DataTable();
- adapter.Fill(table);
- dataGridView1.DataSource = table;
- dataGridView1.AutoResizeColumns();
- sqlConnection.Close();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment