数据库访问很糟糕! [英] Database access sucks!

查看:64
本文介绍了数据库访问很糟糕!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是我或MS已经创建了一些最糟糕的方式来访问和显示

数据?


您可以使用DataSet,但是如果你想要排序或过滤数据必须

使用从DataSet创建的DataView。


但是,如果你使用Grid排序(单击标题)你不能再使用DataSet(或者DataView,如果你正在使用的话)来使用
找到用户选择的记录!!


您必须编写代码才能获得当前位置...这应该只是一个

属性!!

另外,有人可以向我解释为什么FindRows返回

DataRowView ...你可以用DataRowView做什么,我还没找到方法

将这些数据加载到新的DataView或DataSet中(如果有办法,

请向我解释)。似乎FindRows应该只有

返回一个新的DataView !!


我理解为什么所有必要的数据访问组件都被打破了

进入许多不同的部分,但为什么不建立一个组件,

包含所有组件并将其用作增强型数据集。那个

也可以用作网格和其他组件的数据源。(这是我已经为自己做过的事情。)


也许是因为我来自Borland并期待一流的开发

工具/ comopnents ...其中有VCL框架和数据访问组件

最棒的!!!


但我不得不离开Borland,因为他们的管理层表示他们已经杀死了Borland C ++ Builder(BCB) )产品大约6个月前。但是,他们刚刚宣布他们改变了主意,现在将支持

BCB。

这是一个小小的片状对我来说,所以我跳船去了MS。


但是我在VS.NET(C#)中看到的,我可能要谈谈我的机会

与Borland。

It is just me or has MS created some of the worst ways to access and display
data?

You can use a DataSet, but if you want to sort or filter the data to must
use a DataView which is created from a DataSet.

But, if you sort by using the Grid (clicking the header) you can no longer
use the DataSet (or maybe the DataView, if that is what you are using) to
locate the record that the user has selected!!

You have to write code to get the current position...this should just be a
property!!

Also, can someone explain to me why does the FindRows return
DataRowView...what can you do with a DataRowView, I haven''t figure out a way
to load this data into a new DataView or a DataSet (if there is a way,
please explain it to me). It seems that the FindRows should have just
return a new DataView!!

I understand why all of the necessary data access components are broken out
into many different parts, but why not ALSO build a component that
encompasses all of the components and use that as an "enhanced DataSet" that
can also be used as a Datasource to the grid and other components.(This is
something that I have already done for myself.)

Maybe it''s because I''m coming from Borland and expect top notch development
tools/comopnents...where there VCL Framework and Data Access components were
THE BEST!!!

But I had to leave Borland because their management said that they were
killing the Borland C++ Builder (BCB) product about 6 months ago. But, they
just recently announced that they had a change of heart and will now support
BCB.
That''s a little to flaky for me, so I jumped ship and moved to MS.

But with what I have seen in VS.NET (C#), I might have to talk my chances
with Borland.

推荐答案

如果我认为你的投诉适用于DataGrid组件 - 不是

ADO.NET。


实际上,你可以将网格绑定到各种各样的东西 - 包括一个强烈的

类型的集合。 dataViews实际上是基于DataTables而不是数据集。


没有让你停止对子网格进行子类化以获得你想要的

功能。 它应该只是一个财产我想,

除非你想要多选,这需要两个属性 - 或者你需要迭代的一个




DataRowView是必要的b / c它可以显示

数据行的四种不同状态 - 默认 - 当前,原始和建议,这可以非常方便

特别是在断开连接时你想向用户展示

原始价值和他们改变的东西的场景 - 或者只是想向他们展示

改变的行。


DataTable.Select例如会给你一个找到的行数b / b $ b $ - 这又可以用来绑定到网格。这可能会有所帮助。

您可以将DataView的RowFilter设置为您想要的任何搜索条件,只有那些显示。


我承认winforms的dataGrid有点不尽如人意,但是再次

这与ADO.NET没什么关系。我想你会发现写一些自己的控件(或者使用Infragistics)很简单



你可以重复使用和定制满足您的特殊需求。


HTH,


比尔


-

WG Ryan MVP(Windows Embedded)

TiBA解决方案
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com

" Relaxin" < me@yourhouse.com>在留言中写道

news:eP ************** @ TK2MSFTNGP15.phx.gbl ...
If anything I think your complaint applies to the DataGrid component - not
ADO.NET.

Actually, you can bind a grid to all sorts of stuff - inlcuding a strongly
typed collection. dataViews are actually based on DataTables not datasets.

There''s nothign stopping you from subclassing the grid to get the
functionality that you want. "It should just be a property" I guess,
unless you want multiselect which would entail two properties - or one that
you would need to iterate through.

The DataRowView is necessary b/c it can show four different states of the
datarow - Default - Current, Original and Proposed which can be very handy
particularly in a disconnected scenario where you want to show users the
original value and the stuff they changed - or just want to show them the
changed rows.

DataTable.Select for instance will give you an array of the rows that are
found - which in turn can be used to bind to a grid. This may be helpful.
You can set the RowFilter of a DataView to whatever search conditions you
want so only those show.

I admit the dataGrid for Winforms leaves a little to be desired, but again
this has Nothing to do with ADO.NET. I think you''ll find it''s easy enough
to write a few of your own controls (or use Infragistics for instance) that
you can reuse and tailor to your particular needs.

HTH,

Bill

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Relaxin" <me@yourhouse.com> wrote in message
news:eP**************@TK2MSFTNGP15.phx.gbl...
这只是我或者MS是否创建了一些最糟糕的访问方式和
显示数据?

您可以使用DataSet,但如果您想对数据进行排序或过滤,则必须使用从DataSet创建的DataView。

但是,如果您使用Grid排序(单击标题),您将无法再使用DataSet(或者可能是DataView,如果是您正在使用的)找到用户选择的记录!!

您必须编写代码才能获得当前位置...这应该只是一个
属性!!

此外,有人可以向我解释为什么FindRows返回DataRowView ...你可以用DataRowView做什么,我还没弄明白
将这些数据加载到新的DataView或DataSet中的方法(如果有办法,请向我解释)。似乎FindRows应该只返回一个新的DataView !!

我理解为什么所有必要的数据访问组件都被打破了许多不同部分的
,但为什么还没有构建一个包含所有组件的组件,并将其用作增强型数据集。
,也可以用作网格和其他组件的数据源。(这是我已经为自己做过的事情。)

也许这是因为我来自Borland并期待顶级
开发工具/ comopnents ...其中VCL框架和数据访问组件
是最好的!!!

但是我不得不离开Borland,因为他们的管理层说他们在大约6个月前杀死了Borland C ++ Builder(BCB)产品。但是,
他们刚刚宣布他们改变了主意,现在
支持BCB。
这对我来说有点小,所以我跳船然后转向MS。

但是我在VS.NET(C#)中看到的,我可能要和Borland谈谈我的机会。
It is just me or has MS created some of the worst ways to access and display data?

You can use a DataSet, but if you want to sort or filter the data to must
use a DataView which is created from a DataSet.

But, if you sort by using the Grid (clicking the header) you can no longer
use the DataSet (or maybe the DataView, if that is what you are using) to
locate the record that the user has selected!!

You have to write code to get the current position...this should just be a
property!!

Also, can someone explain to me why does the FindRows return
DataRowView...what can you do with a DataRowView, I haven''t figure out a way to load this data into a new DataView or a DataSet (if there is a way,
please explain it to me). It seems that the FindRows should have just
return a new DataView!!

I understand why all of the necessary data access components are broken out into many different parts, but why not ALSO build a component that
encompasses all of the components and use that as an "enhanced DataSet" that can also be used as a Datasource to the grid and other components.(This is
something that I have already done for myself.)

Maybe it''s because I''m coming from Borland and expect top notch development tools/comopnents...where there VCL Framework and Data Access components were THE BEST!!!

But I had to leave Borland because their management said that they were
killing the Borland C++ Builder (BCB) product about 6 months ago. But, they just recently announced that they had a change of heart and will now support BCB.
That''s a little to flaky for me, so I jumped ship and moved to MS.

But with what I have seen in VS.NET (C#), I might have to talk my chances
with Borland.



您可能会发现此链接也很有用
http://weblogs.asp.net/codemouse/

-

WG Ryan MVP(Windows Embedded)


TiBA解决方案
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com

" Relaxin" < me@yourhouse.com>在留言中写道

news:eP ************** @ TK2MSFTNGP15.phx.gbl ...
You may find this link helpful as well
http://weblogs.asp.net/codemouse/
--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Relaxin" <me@yourhouse.com> wrote in message
news:eP**************@TK2MSFTNGP15.phx.gbl...
这只是我或者MS是否创建了一些最糟糕的访问方式和
显示数据?

您可以使用DataSet,但如果您想对数据进行排序或过滤,则必须使用从DataSet创建的DataView。

但是,如果您使用Grid排序(单击标题),您将无法再使用DataSet(或者可能是DataView,如果是您正在使用的)找到用户选择的记录!!

您必须编写代码才能获得当前位置...这应该只是一个
属性!!

此外,有人可以向我解释为什么FindRows返回DataRowView ...你可以用DataRowView做什么,我还没弄明白
将这些数据加载到新的DataView或DataSet中的方法(如果有办法,请向我解释)。似乎FindRows应该只返回一个新的DataView !!

我理解为什么所有必要的数据访问组件都被打破了许多不同部分的
,但为什么还没有构建一个包含所有组件的组件,并将其用作增强型数据集。
,也可以用作网格和其他组件的数据源。(这是我已经为自己做过的事情。)

也许这是因为我来自Borland并期待顶级
开发工具/ comopnents ...其中VCL框架和数据访问组件
是最好的!!!

但是我不得不离开Borland,因为他们的管理层说他们在大约6个月前杀死了Borland C ++ Builder(BCB)产品。但是,
他们刚刚宣布他们改变了主意,现在
支持BCB。
这对我来说有点小,所以我跳船然后转向MS。

但是我在VS.NET(C#)中看到的,我可能要和Borland谈谈我的机会。
It is just me or has MS created some of the worst ways to access and display data?

You can use a DataSet, but if you want to sort or filter the data to must
use a DataView which is created from a DataSet.

But, if you sort by using the Grid (clicking the header) you can no longer
use the DataSet (or maybe the DataView, if that is what you are using) to
locate the record that the user has selected!!

You have to write code to get the current position...this should just be a
property!!

Also, can someone explain to me why does the FindRows return
DataRowView...what can you do with a DataRowView, I haven''t figure out a way to load this data into a new DataView or a DataSet (if there is a way,
please explain it to me). It seems that the FindRows should have just
return a new DataView!!

I understand why all of the necessary data access components are broken out into many different parts, but why not ALSO build a component that
encompasses all of the components and use that as an "enhanced DataSet" that can also be used as a Datasource to the grid and other components.(This is
something that I have already done for myself.)

Maybe it''s because I''m coming from Borland and expect top notch development tools/comopnents...where there VCL Framework and Data Access components were THE BEST!!!

But I had to leave Borland because their management said that they were
killing the Borland C++ Builder (BCB) product about 6 months ago. But, they just recently announced that they had a change of heart and will now support BCB.
That''s a little to flaky for me, so I jumped ship and moved to MS.

But with what I have seen in VS.NET (C#), I might have to talk my chances
with Borland.



>这只是我或MS创建了一些访问和显示
>It is just me or has MS created some of the worst ways to access and display
数据的最糟糕的方法?


这只是你! :-)嘿,你几乎*问了*! ;-)


说真的,一开始ADO.NET可能不完全直观,但它确实很棒 - 它包含了很多功能! />
您可以使用DataSet,但是如果要对数据进行排序或过滤,则必须使用从DataSet创建的DataView。


您可以使用DataView(基于* DataTable *创建 - 而不是

DataSet - 观看您的条款!!您必须得到正确的信息才能获得事情正确!)

以任何方式,形状或形式对数据进行排序和过滤。


哎呀,你可以把你的数据存储在DataTable中,并通过十几种不同的数据视图来看待它们b / b $ - $过滤和排序到你的

hearts''内容!这有多强大?

另外,有人可以向我解释为什么FindRows会返回DataRowView ...你可以用DataRowView做什么,我还没找到办法
将此数据加载到新的DataView或DataSet中
data?
It''s just you! :-) Hey, you almost *ASKED* for that! ;-)

Seriously, ADO.NET might not be totally intuitive at first, but it
really rocks - it packs a LOT of power!
You can use a DataSet, but if you want to sort or filter the data to must
use a DataView which is created from a DataSet.
You can use a DataView (based and created from a *DataTable* - not a
DataSet - watch your terms!! You gotta be EXACT to get things right!)
to sort and filter the data in any way, shape or form.

Heck, you can have your data stored in a DataTable, and look at it
through a dozen different data views - filtering and sorting to your
hearts'' content! How powerful is that?
Also, can someone explain to me why does the FindRows return
DataRowView...what can you do with a DataRowView, I haven''t figure out a way
to load this data into a new DataView or a DataSet



DataRowView就像DataRow一样 - 仅用于视图。如果您需要

基础DataRow,只需从

DataRowView的.Row属性中获取它 - 这有多容易?


我真的认为你应该把更多的脑力投入学习

并理解ADO.NET - 你还没有掌握所有的力量

它只是然而!读一本书,阅读在线帮助,研究样品 -

它是值得的!


Marc

================================================== ==============

Marc Scheuner可能是你的来源!

伯尔尼,瑞士m.scheuner(at)inova。 ch



A DataRowView is just like a DataRow - only for a view. If you need
the underlying DataRow, just grab it from the .Row property of the
DataRowView - how easy is that?

I really think you ought to put a bit more brain power into learning
and understanding ADO.NET - you haven''t grasped all the power behind
it just yet! Read a book, read the online help, study the samples -
it''ll be worth it!

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch


这篇关于数据库访问很糟糕!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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