当前位置:编程学习 > C#/ASP.NET >>

两个DataGridView之间如何移动选定数据和批量该数据??





如能帮我.可另开贴给分.


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;
using System.Data.SqlClient;
using System.Configuration;
namespace WindowsFormsApplication7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button查询_Click(object sender, EventArgs e)
        {

            string customers = "SELECT 姓名,班级,是否及格 FROM 成绩表";

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["数据库连接"].ConnectionString))
            {

                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(customers, con);
                da.Fill(ds, "成绩表");
                dataGridView1.DataSource = ds;
                dataGridView1.DataMember = "成绩表";


            }

        }

        private void button向右移动_Click(object sender, EventArgs e)
        {
            //请给代码,谢谢.
        }

        private void button向左移动_Click(object sender, EventArgs e)
        {
            //请给代码,谢谢.

        }

        private void button修改_Click(object sender, EventArgs e)
        {
            //请给代码,谢谢.
        }
    }
}

--------------------编程问答-------------------- 如果你绑定了数据,你可以通过对datatable操纵,然后再绑定,如果没有绑定到数据,那就简单了,直接对grid的row操作就好了
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,