惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

博客园 - 什么都不知道

DataSet的Xml序列化问题 VB.NET的一个小问题 Access is denied的问题 - 什么都不知道 存储过程output参数问题 SQL Server的效率? 使用Visio DrawingControl的应用开发(补) 突起效果的Label WinForm下TextBox的数据绑定和更新 使用Radio按钮选择DataGrid行 如何在运行时加载不处于应用程序目录下的assembly 使用VSA给程序加上脚本支持 删除所有Windows组件 在ASP.NET中嵌入wml标记 c#中动态装载dll 处理大型xml文件 RedirectToMobilePage的问题 使用Visio 2003 Drawing Control开发应用(3)(4) 使用Visio 2003 Drawing Control开发应用(2) 使用Visio 2003 Drawing Control开发应用(1)
datagrid刷新问题
什么都不知道 · 2004-11-27 · via 博客园 - 什么都不知道

DataGrid如果绑定了数据之后,会出现下面的情况。

当用鼠标选中某一编辑框的情况下,对DataGrid的数据源DataSource进行更新,会出现

列xxx不属于table的错误

stacktrace最后是
.... DataRow.CheckColumn .....

出现的前提情况包括:

1、对datagrid设置了tablestyle,做了对字段的映射

2、在向右拉动了滚动条

3、选中的编辑框不是最后一列

解决方法

在进行刷新之前,先将datagrid的tablestyles清空,然后再加进去。比如:

  

 try
   {
    this.sqlConnection1.Open();
    using(this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter())
    {
     this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
     DataSet ds = new DataSet();
     this.sqlDataAdapter1.Fill(ds);
     ds.Tables[0].TableName = "titles";
     if(this.dataGrid1.DataSource != null)
     {
      this.dataGrid1.TableStyles.Clear();
     }
     this.dataGrid1.TableStyles.Add(this.dataGridTableStyle1);
     this.dataGrid1.DataSource = ds.Tables[0].DefaultView;
    }
   }
   catch(Exception ex)
   {
    throw ex;
   }
   finally
   {
    this.sqlConnection1.Close();
   }

原因未知

影响包括.net framework 1.0, .net framework 1.1