コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection MyConnection = new SqlConnection();

            MyConnection.ConnectionString = ConnectionClass.Connection_Path();
            MyConnection.Open();
            string         somut = "select a.username from KULLANICI AS A ";
            SqlDataAdapter da    = new SqlDataAdapter(somut, MyConnection);
            DataTable      dt    = new DataTable();

            da.Fill(dt);
            dataGridView1.DataSource = dt;
            label1.Text = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString();

            MyConnection.Close();
        }