您使用数据感知类吗?
我用的是VB6。
数据感知类是指设置了 DataBindingBehavior 或 DataSourceBehavior 属性的类。
我从 MSDN 中学到了这个概念,并且通常想知道我们什么时候应该使用这种数据感知类技术? 或者就像大多数开发人员忽略的数据环境设计器一样?
I'm using VB6.
Data-aware classes refers to classes whose DataBindingBehavior or DataSourceBehavior property is set.
I learned this concept from MSDN and am wondering usually when should we use this technique of Data-aware classes? Or just like the Data Environment Designer which is just ignored by most developers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为大多数 VB6 开发人员都忽略了该功能。 当然,我尝试过一次,就再也没有使用过。 如果您 Google DataBindingBehavior 或 DataSourceBehavior,搜索结果相对较少。
我认为 John 在他的回答中试图传达的是,VB6 对于新开发来说不是一个好的选择,除非您有充分的理由反对 - 例如,如果您的组织已经拥有大量 VB6 经验和大量 VB6 代码维护,并且没有其他桌面编程语言的经验。 对于你的情况来说,这听起来不太可能,否则你会问你的同事这个问题,而不是在 Stack Overflow 上发帖!
I think that feature has been ignored by most VB6 developers. Certainly I experimented with it once and never used it again. If you Google DataBindingBehavior or DataSourceBehavior there are relatively few hits.
I think what John is trying to communicate in his answer is that VB6 is not a good choice for new development unless you have strong reasons to the contrary - for example if your organisation already has a lot of VB6 experience and a lot of VB6 code to maintain, and no experience of other desktop programming languages. That sounds unlikely in your case, otherwise you'd be asking your colleagues the question rather than posting on Stack Overflow!
你知道VB6有多少年历史了吗? 已经有十岁左右了。 您完全应该忽略从 VB6“学到”的任何内容。
有关 VB6 的一些资源:
Visual Basic 6.0 产品系列生命周期指南(它是 截至 2008 年 3 月,不支持):
<块引用>
在一般产品上市九年后,将不再提供对 Visual Basic 6.0 的支持。
从 2008 年 3 月开始,将不再支持 Visual Basic 6.0。
所有这些都来自以下搜索:http://social.msdn.microsoft.com/Search/en-US/?Refinement=22&Query=vb6。
Do you have any idea how old VB6 is? It's about ten years old. You should pretty well ignore anything you "learn" from VB6.
Some resources on VB6:
Product Family Life-Cycle Guidelines for Visual Basic 6.0 (it is unsupported as of March 2008):
All of this is from the following search: http://social.msdn.microsoft.com/Search/en-US/?Refinement=22&Query=vb6.
创建数据感知类的能力只是 Visual Basic 扩展性模型的另一个方面。 除了创建标准类和用户控件的能力之外,您还可以将它们创建为可插入 VB 数据绑定机制的数据感知类。
您可以包装诸如 ADO Recordset 或 ADO Data Control 之类的组件来创建更特定于应用程序的组件,也可以从头开始创建自己的组件来为某种特殊数据提供数据绑定。 您甚至可以通过结合 OLE DB Simple Provider (OSP) 工具包编写 VB6 数据感知类来创建基本的自定义 OLE DB 提供程序,以满足不寻常的需求。
这些东西中的大多数现在很少使用,因为 VB6 教育非常缺乏。 许多通过示例学习的程序员都回避数据绑定,因为他们发现它令人沮丧。 但其中大部分是缺乏理解。 相反,我们依靠编写大量类似 QBasic 的过程代码来牺牲基于 VB6 事件编程的功能。
您会在大量随意使用的 VB.Net 和 C# 代码中看到同样的情况。 人们似乎没有意识到事件驱动编程实际上比“OOPiness”的程度重要得多,但这似乎正是焦点所在。
了解这一点重要性的程序员往往会在 VB6 程序中使用更少的 DoEvents 循环,并且在 .Net 程序中几乎没有无用的多线程。
我和任何人一样对避免使用数据环境设计器和绑定控件感到内疚。 我计划更多地了解它们的用途和功能,并更多地使用 VB6 的数据报表设计器。 这些是用于编写以数据为中心的程序的强大工具,我最近在做更多的事情。
毫无疑问,微软已经放弃了对 VB6 开发的所有支持。 但这并没有说明对其的需求仍然强劲。 如果人们对回答有关 VB6 的问题没有什么贡献,他们可能会把精力花在其他地方,而不是在这里大喊大叫。 非常遗憾的是我们从未得到后续产品 - 一个支持 64 位开发的更新的 VB 会非常好。 它只是不存在于卡片中。
The ability to create data-aware classes is just another aspect of Visual Basic's extensibility model. Along with the ability to create standard Classes and UserControls, you can create them as data-aware classes that can plug into VB's data binding mechanism.
You can wrap something like an ADO Recordset or ADO Data Control to create a more application-specific component, or you can create your own from scratch to provide data binding for some sort of out of the ordinary data. You can even create basic custom OLE DB Providers for unusual requirements by writing VB6 data aware classes in conjunction with the OLE DB Simple Provider (OSP) Toolkit.
Most of these things are rarely used today, because VB6 education is sorely lacking. A lot of programmers who learned by example shy away from data binding because they've found it frustrating. Most of this is a lack of understanding though. Instead we fall back on writing a lot of QBasic-like procedural code that sacrifices the power of VB6 event based programming.
You'll see the same thing in a lot of VB.Net and C# code loose in the wild. People seem unaware that event driven programming is actually much more important than the degree of "OOPiness" yet that's where the focus seems to be.
Programmers who understand the importance of this tend to have a lot fewer DoEvents loops in their VB6 programs and almost no gratuitous multithreading in their .Net programs.
I am as guilty as anyone of avoiding the Data Environment Designer and bound controls. I plan to become more aware of their use and capabilities though as well as making more use of VB6's Data Report Designer. These are powerful tools for writing data-centric programs, something I'm doing a lot more of lately.
There is no argument that Microsoft has dropped all support for VB6 development. But this doesn't say anything about the demand for it, which continues to be strong. If people have little to contribute to answering a question about VB6 they might spend their effort better elsewhere instead of shouting it down here. It is very sad that we never got a follow-on product - a newer VB supporting 64-bit development would be really nice. It just isn't in the cards.