Advertisement
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 WindowsFormsApp6
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- Form2 dlg = new Form2();
- if (dlg.ShowDialog() != DialogResult.OK)
- {
- Application.Exit();
- }
- string connetionString = @"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\Student\source\repos\WindowsFormsApp6\WindowsFormsApp6\PacientiSpital.mdf; Integrated Security = True";
- SqlConnection cnn = new SqlConnection(connetionString);
- cnn.Open();
- string tabel_date = "select * from Pacienti";
- SqlDataAdapter da = new SqlDataAdapter(tabel_date, connetionString);
- DataSet ds = new DataSet();
- da.Fill(ds, "Pacienti");
- dataGridView1.DataSource = ds.Tables["Pacienti"].DefaultView;
- cnn.Close();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Form3 dlg = new Form3();
- if (dlg.ShowDialog() != DialogResult.OK)
- {
- Application.Exit();
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string get_id_string = "SELECT * FROM Pacienti where Nume=" + "'" + textBoxCauta.Text + "'";
- MessageBox.Show("Pacientul" + get_id_string + "a fost gasit");
- }
- private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement