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.Data.SqlClient;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace B5_Veljko
- {
- public partial class Form3 : Form
- {
- SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-BEDE3AM\SQLEXPRESS;Initial Catalog=B5;Integrated Security=True");
- public Form3()
- {
- InitializeComponent();
- }
- private void Form3_Load(object sender, EventArgs e)
- {
- }
- private void button2_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string k = "select i.Ime,i.Prezime,k.NazivKluba" +
- " from Pozicija_igraca p,Igrac i, Klub k" +
- " where p.PozicijaID = i.PozicijaID and i.KlubID = k.KlubID;" +
- " and k.GradID="+comboBox1.SelectedValue;
- try
- {
- con.Open();
- SqlCommand cmd = new SqlCommand(k, con);
- DataTable T = new DataTable();
- SqlDataAdapter A = new SqlDataAdapter(cmd);
- A.Fill(T);
- dataGridView1.DataSource = T;
- }
- catch (Exception x)
- {
- MessageBox.Show(x.Message);
- throw;
- }
- finally
- {
- if (con.State == ConnectionState.Open) con.Close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement