日期:2014-05-17 浏览次数:20964 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DataGridViewTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
bind();
dataGridView1_CellClick((object)this.dataGridView1, new DataGridViewCellEventArgs(1, 1));
}
private void bind()
{
using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(数据库连接)
{
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select * from diabatch", conn);
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd);
&nbs