在DataGridView中显示旧值和新值 [英] Show old value and new value in DataGridView

查看:157
本文介绍了在DataGridView中显示旧值和新值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DataGridView 中,我需要显示旧值以及新值。



I从 DataTable 中选择一些值并显示在 DataGridView 中。下次我要从 DataTable 中选择一些值并且需要显示在相同的 DataGridView 中,这样很好旧价值......

 私人  void  button1_click( object  sender,EventArgs e)
{
string strGetProductName;
strGetProductName = sender.ToString();
strGetProductName = strGetProductName.Replace( System.Windows.Forms.Button,Text: );

strCon = GetConnectionString();
OleDbConnection objCon = new OleDbConnection(strCon);
string Query = 选择类别,子类别来自tblProduct的,Rate,Qty,其中SubCategory =' + strGetProductName + ';
objCon.Open();
OleDbDataAdapter adpter = new OleDbDataAdapter(Query,objCon);
DataTable dt = new DataTable();
adpter.Fill(dt);
objCon.Close();
dataGridView1.DataSource = dt;
}

解决方案

访问这里...



比较DataGridView单元格中的旧值和新值 [ ^ ]







添加链接文字以反映文章标题。

[/编辑]

In DataGridView, I need to display the old value and also the new value too.

I selected some values from DataTable and showing in DataGridView. It's fine next time I am going to select some value from DataTable and need to display in the same DataGridView, but that old values...

private void button1_click(object sender,EventArgs e)
{ 
    string strGetProductName;
    strGetProductName = sender.ToString();
    strGetProductName = strGetProductName.Replace("System.Windows.Forms.Button, Text: ", "");
    
    strCon = GetConnectionString();
    OleDbConnection objCon = new OleDbConnection(strCon);
    string Query = "Select Category,SubCategory,Rate,Qty from tblProduct where SubCategory ='" + strGetProductName + "' ";
    objCon.Open();
    OleDbDataAdapter adpter = new OleDbDataAdapter(Query, objCon);
    DataTable dt = new DataTable();
    adpter.Fill(dt);
    objCon.Close();
    dataGridView1.DataSource = dt;
}

解决方案

visit here...

Compare old and new value in DataGridView cell[^]


[Edit member="Tadit"]
Link text added to reflect the article title.
[/Edit]


这篇关于在DataGridView中显示旧值和新值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆