Fill DataGridView by SqlConnection

Publié le: 13 août 2012
sur la chaîne: 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);
}
}
}


Sur cette page du site, vous pouvez voir la vidéo en ligne Fill DataGridView by SqlConnection durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Ashish Jaryal 13 août 2012, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 920 fois et il a aimé 1 téléspectateurs. Bon visionnage!