Database access sucks!

R

Relaxin

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.
 
W

W.G. Ryan eMVP

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
 
M

Marc Scheuner [MVP ADSI]

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

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

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
 
C

Cor Ligthert

Marc,
It's just you! :) Hey, you almost *ASKED* for that! ;-)
Why you wrote that. (I first did want you to give an answer and than answer
that again with). "It was only that I could not now".

:)

Cor
 
R

Relaxin

----- Original Message -----
From: "Marc Scheuner [MVP ADSI]" <[email protected]>
Newsgroups: microsoft.public.dotnet.general
Sent: Tuesday, December 28, 2004 11:00 PM
Subject: Re: Database access sucks!
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?

That is exactly my point, why not just have FindRows return a DataView!!
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!
I have and I've used the best. I also used and created components from
OLEDB.
ADO.NET has alot to be desired and they are also missing functionality that
OLEDB had.
Such as the different resultset types (Keyset, dynamic, forwardonly,
etc...).

With the .NET dataset, it forces you to load all of the data to the
client...this doesn't work so well when you database is mainly made up of
images!

I hate it when the vendor (MS) tells me how I should write my code by
removing functionality and not replacing it with something similar.

----- Original Message -----
From: "Marc Scheuner [MVP ADSI]" <[email protected]>
Newsgroups: microsoft.public.dotnet.general
Sent: Tuesday, December 28, 2004 11:00 PM
Subject: Re: Database access sucks!
 
C

Cor Ligthert

Relaxin,

Probably is your major mistake although you are not writing it, that you
compare a dataset with a recordset, what is not the case. A recordset is
comparable with a datatable.

The datatable has a lot of extra's above the recordset by instance a
dataview, with can show you data in a lot of ways. This newsgroup is not the
part to show all advantages from a datatable above a recordset.

And not to tell that there are only advantages in some cases can the
standard optimistic concurrency in my opinion be a disadvantage, however
modern disconnected use makes pessimistic concurrency in my opinion very
hard to do and should only be done when it is really needed

To select one or more datarows from a datatable you can use the
datatable.select
You can as well find a row in the datarow collection in a datatable by using
a datarowcollection.find
Or get a selection by using the dataview.rowfilter
Or get a position of a datarow in a dataview by the dataview.find

You can use as well of course to narrow your datatable the different select
where clauses.

Maybe you can say it was more simple with the recordset because it had not
all those possibilities. The same as people who went from the T Ford to a
more advantage car. The T Ford was well made however nobody forced those
people to use another car.

Just my thought,

Cor
 
R

Relaxin

The datatable has a lot of extra's above the recordset by instance a
dataview, with can show you data in a lot of ways. This newsgroup is not
the part to show all advantages from a datatable above a recordset.

A recordset is comparible to a datatable (in your example) if you are going
to use the dataset to create the dataview.
You could also use other oledb components and functions to sort, filter,
etc.. to create the same "dataview" "like" data.
So you are making a mute point here.
And not to tell that there are only advantages in some cases can the
standard optimistic concurrency in my opinion be a disadvantage, however
modern disconnected use makes pessimistic concurrency in my opinion very
hard to do and should only be done when it is really needed

And where are you coming up with this "pessimistic concurrency", I have
always used optimistic concurrency.
In fact OLEDB allowed you to use SQL Servers rowversion (1 field) as a
method to update a record.
ADO.NET will use a WHERE clause of all of the columns within your SELECT
statement.
This is a very inefficient why to update a record!

To select one or more datarows from a datatable you can use the
datatable.select
You can as well find a row in the datarow collection in a datatable by
using a datarowcollection.find
Or get a selection by using the dataview.rowfilter
Or get a position of a datarow in a dataview by the dataview.find

You can use as well of course to narrow your datatable the different
select where clauses.

Maybe you can say it was more simple with the recordset because it had not
all those possibilities.

Your statements are "trying" to limit my argument to the recordset, but you
have used a DataSet, DataTable, DataView and a DataRowCollection!!
Lets be fair about this, OLEDB and ADO.NET are both comprised of classes and
the classes are designed to work together, except MS has removed alot of
functionality from some of the ADO.NET classes.
 
C

Cor Ligthert

Relaxin,

I get more and more the idea that you don't know what is a dataset,
datatable, datarow, dataview and/or a datarowview in ADONET. Can you explain
what they are in your opinion.

Because when we talk about different things it is hard to make a discussion.

Cor
 
R

Relaxin

I know EXACTLY what they are, but since you asked for it.

The DataSet contains 1 or more DataTables.
A DataTable contains 1 or more DataRows.
A DataRow contains 1 or more DataColumns.
A DataView is a subset and/or sorted view of the DataSet.
I'm still unsure what the purpose of the DataRowViews is, but I know
DataRowView.FindRows returns it.

Like I mentioned earlier, I have created my own components to handle things
the way they should be.

I'm mainly venting because I would have expected a better design from MS,
but I guess if you(most people in this NG, I assume) haven't seen anything
other than MS, you wouldn't have anything to compare it to.
So of course you would think that this design is great.

Give Borland a try when you get a chance, you will see a hell of a design.
You can tell that Borland tools are Developed By Developers for Developers.

MS is designed for cash only!!
 
C

Cor Ligthert

Relaxin
I know EXACTLY what they are, but since you asked for it.
The DataSet contains 1 or more DataTables
references 0 or more
A DataTable contains 1 or more DataRows
references 0 or more.
A DataRow contains 1 or more DataColumns.
A DataRow references 0 or more Items described by the columncollection from
the DataTable
A DataView is a subset and/or sorted view of the DataSet.
The DataView is a view on a datatable not on the Dataset (as you
consequently state) which has filters and sort parameters in it. Every
DataTable contains one Dataview named DefaultView.
I'm still unsure what the purpose of the DataRowViews is, but I know
A DataRowView is a view on an single datarow however as well on other class
objects
DataRowView.FindRows returns it.
I don't know the DataRowView.FindRows method so I do not know what you mean
with this.

I don't think that your first statement about EXACTLY is very correct.

Just my thought,

Cor
 
J

J. Buelna - Houston, TX

Relaxin said:
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.


Hello Relaxin,

I'm sorry, I don't have time to go into details. Here are some references:

Microsoft® ADO.NET Step by Step
http://www.microsoft.com/mspress/books/4825.asp

Microsoft® ADO.NET (Core Reference)
http://www.microsoft.com/mspress/books/5354.asp

Professional ADO.NET
http://www.amazon.com/exec/obidos/t...102-3805879-7946505?v=glance&s=books&n=507846

It would be good to learn and fully understand ADO.NET on an academic level
before trying to use it in a commercial project. Unless your employer
allows you to learn the as you go.

ADO.NET is not perfect, but there was a lot of thought that went into
architecting it and rest assured that there is a solution for most of the
problems you'll run into.

J. Buelna - Houston, TX
 
M

Michel van den Berg

Why don't you try using LLBLGen Pro (www.llblgen.com). I find it much
easier to use then the default way of data access.

Have a nice New Years Eve,

Michel van den Berg
 
R

Relaxin

What I need is a connected resultset within the confines of a DataSet.

My database is full of images, and as you could imagine, this is a painful
process when they are all loaded to the clientside.

Anyone with any knowledge in this area?
 
N

Nick Malik [Microsoft]

Hello Relaxin,

apart from your last statement, which was a bit unfair, you are not wrong in
your description of the object tree for a dataset. That said, datasets are
part of a disconnected data retrieval model that is far more scalable than
the prior database tools. By the way, you bashed MS for the new structure,
and referred to Borland, but MS created the older structure too. Seems odd
to bring Borland into it at all.

Certainly, you can create "chatty" data interaction models that will do the
exact same thing as "keyset". The rest of the retrieval types are perfectly
available in ADO.NET, if you know how to use it. While I may take a
different tone that Cor, I would have to say that he has a point: there is
very little useful functionality "lost" in ADO.NET.

From what I've heard, the product teams were getting a lot of heat because
the prior stuff had serious scalability problems. The responses were
something along the lines of "If the feature looks good, but leads to
serious problems later, why is it there? Remove it now and save us the
pain. We have to live with this stuff." MS was simply responding to the
express needs of their base. If the make a little money along the way...
good. That's called capitalism.

Back to technology.

If you have images in some of your columns, don't return those columns in
your dataset. Use a select statement or a stored proc to select only the
rows that you need for your non-image processing, and then when you need an
image, ask for it from the database using a seperate statement. It's what
the older tools used to do for you, but at least this way, the code is
yours, so you are at more liberty to tweak it to get the performance you
need.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
C

Cor Ligthert

Nick,

My tone changed (and even not aggressively) after a while when there were
only messages that Borland was better and that a dataview was a not good
functioning member of a dataset and the DataRowView.FindRows returns only a
datarowview, where it should be a position.

So please read first my first message before you write this kind of
sentences about my tone.

Where I know that your sentence is not bad intended, however it can be read
as that. When you had written "in a different style", I would not have
complained.

Just to make this clear.

Cor
 
W

W.G. Ryan eMVP

Use a DataReader then - there's nothing to stop you from using the reaader
to store the info you need either in a dataset or collection of business
objects - however I'm not sure of the value of such an approach.
 
W

W.G. Ryan eMVP

Relaxin - semantically you made a few goofs but you have the overall
concepts down and that's what's important.

The key thing that a DataRowView is used for in my experience is determining
state. Short of that - I don' think there's a whole lot of importance.

This is a technical distinction but let me make it anyway - when you are
looking at data, normally you only want to see one form of it - it's current
state. However if you needed to know what the previous state was - so you
could revert to it or show a confirm dialog - you may want to use it here.
 
M

Marc Scheuner [MVP ADSI]

A DataRowView is just like a DataRow - only for a view. If you need
That is exactly my point, why not just have FindRows return a DataView!!

Well, maybe because not everyone wants to use a DataView? Don't take
*YOUR* requirements and make them general - they might not be general
enough to be considered suitable for EVERYONE. Now there would
definitely be a possibility to at least provide an overloaded function
..FindRows that would return a DataView - then again, maybe MS decided
when they designed ADO.NET that this was too exotic an option.

After all, you really don't need to do much to get a DataView from
your results - just do it!
With the .NET dataset, it forces you to load all of the data to the
client...this doesn't work so well when you database is mainly made up of
images!

Well, then you might need to redesign your app - maybe you don't need
to select ALL the records INCLUDING the pictures! Maybe just rewrite
your app to select FEWER records, and leave the images in the DB,
until you REALLY need them.

Heck, it's not ALWAYS MS's fault when your system is designed badly!
;-)

Marc

================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top