通过集合、ORM 列表查看数据库
我一直在研究如何以及使用什么来获取类中字段的名称,然后调用该类并获取该类的属性,如字段值中的属性。 举个例子,假设我要从一个表的一条记录中获取一个值,我将创建该类的一个对象,如下所示;
DBTable<cars> cartable = new DBTable<cars>(1) //passing 1 is a dataset number
cartable.GetLastRec(); OR cartable.Attributes.Key.carIdx // record index
cartable.GetKeyRec();
// Now I print the value
Console.WriteLine("Car number: " + cartable.Attributes.Data.number;
获得一条记录很容易,它就像一个面向对象的数据库,但不确定它是否不是,我对数据库系统没有任何了解,只是这些类用于与 DLL 文件通信并传递一些数字。
到目前为止,我一直在测试集合、继承、ORM,没有任何接缝能够描述正在发生的非常简单的过程,甚至动态调用对象并迭代它的属性 我希望做的是; 数据网格视图 => 表类 => DLL入口点=> 数据库
如果有人遇到过同样的挑战,或者我可能在这里采取了错误的方法,但在这个阶段完全迷失了,欢迎任何想法 预先感谢
顺便说一句:我正在使用 VS2005、.NET 2.0
I've been researching to find out how and what to use to get say the name's of the fields in a class, then to invoke that class and get the properties of the class, as in the field values.
Give you an example, Say if I one to get one value from one record from one table, I would create an object of that class as in;
DBTable<cars> cartable = new DBTable<cars>(1) //passing 1 is a dataset number
cartable.GetLastRec(); OR cartable.Attributes.Key.carIdx // record index
cartable.GetKeyRec();
// Now I print the value
Console.WriteLine("Car number: " + cartable.Attributes.Data.number;
It's easy to get one record, it's like an Object Orientated Database but not sure if it isn't, I don't have any knowledge of the database system, just that the classes are used to talk to a DLL file and pass some numbers.
so far I've been testing with collections, inheriting, ORM, and nothing seams to be able to describe the very simple process going on, Even dynamic invoking objects and iterating over it's attributes
What I hope do is;
Datagridview => Table Classes => DLL entry points => Database
If anyone has had the same challenge or maybe I have the wrong approach here, but completely lost at this stage, Any Idea's welcome
Thanks in Advance
btw: I'm using VS2005, .NET 2.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实现此目的的唯一方法是提供您自己的
PropertyDescriptorCollection
。在此处或在 Google 上进行搜索应该会为您指明正确的方向。
The only way to do this is by providing your own
PropertyDescriptorCollection
.A search here or on Google, should point you in the correct direction.