Fill DataGridView by SqlConnection

Pubblicato il: 13 agosto 2012
sul canale di: 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);
}
}
}


In questa pagina del sito puoi guardare il video online Fill DataGridView by SqlConnection della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Ashish Jaryal 13 agosto 2012, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 920 volte e gli è piaciuto 1 spettatori. Buona visione!