Fill DataGridView by SqlConnection

Publicado em: 13 Agosto 2012
no canal de: Ashish Jaryal
920
1

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.Windows.Forms;

namespace WA_Table_Udao
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection thisConnection = new SqlConnection(@"Data Source=HOME-PC\SQL2K8;Initial Catalog=ACCOUNTING1;Integrated Security=True");
private void button1_Click(object sender, EventArgs e)
{
//SqlConnection thisConnection = new SqlConnection(@"Data Source=HOME-PC\SQL2K8;Initial Catalog=ACCOUNTING1;Integrated Security=True");
SqlDataAdapter thisAdapter=new SqlDataAdapter("Select ColumnId,ColumnName From table_bnao",thisConnection);

SqlCommandBuilder thisCommandBuilder = new SqlCommandBuilder(thisAdapter);
DataSet thisDataSet = new DataSet();
thisAdapter.Fill(thisDataSet, "table_bnao");
//richTextBox1.Text = "";
//richTextBox1.Text += thisDataSet.Tables["table_bnao"].Rows[0][0];
dataGridView1.DataSource = thisDataSet.Tables["table_bnao"];


}

private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = dataGridView1.CurrentCell.Value.ToString();
}

private void button3_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Remove(dataGridView1.CurrentRow);
}
}
}


Nesta página do site você pode assistir ao vídeo on-line Fill DataGridView by SqlConnection duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Ashish Jaryal 13 Agosto 2012, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 920 vezes e gostou 1 espectadores. Boa visualização!