List Info

Thread: Database access without using a dataset




Database access without using a dataset
user name
2006-06-21 19:19:07
Normally I would agree with you.  But in this case, Connx
acts as a database
interface for our mainframe flatfiles.  A query with a
filter that may
return only 40,000 records times out on the mainframe before
it is complete.
I'll see the 40,000 records, but the query would never end
because of the
mainframe timeout.  Unfortunately, I don't have the clout
to make them
upgrade from the flatfiles to a database driven system or
this would not be
an issue.

This is an issue with our system that I no control over.  So
I just want to
make one query for each piece of data.  It is not that much,
and I am only
reading, so I am fine with that.  I am going to check out
the datareader
solution as well as others that were mentioned, and will let
y'all know how
it turns out.

Thanks,
Kelly

-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On Behalf Of Don
Edwards
Sent: Wednesday, June 21, 2006 11:29 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Database access without using a
dataset

From:    Kelly Baker <kbakerHOWARD-IND.COM>

>I need to access an ODBC database (Connx), running a
single
>query at a time. I DO NOT want to set up or fill a
dataset
>because of the immense size of this database.

That's like saying you don't want a piece of paper because
there are so many trees in the forest.

It is very easy to produce a small dataset by querying a
large
database - just use queries that don't return many rows. It
is
almost as easy to produce a huge dataset by querying a small
database (a few cartesian joins will help here).

>How do I set up a database connection in .Net 2.0 so I
can
>open a connection, run a query on the database, and
close the
>connection, retrieving only the data I am querying for?

You might look at a datareader. The thing with a datareader,
though, is (as I understand it) you can't close or reuse
the
connection until you are through with the data. A connection
is
a rather substantial resource on BOTH ends, and the server
probably has a limited supply of them. A dataset is much
less
resource intensive.

>Every time I try to use the Data Source Wizard, it tries
to set
>up a dataset.

That's excellent. You just need to have a look at how it's
going
to populate that dataset. You want it populated with the
data
you want, not all data in the database.

If you're updating the data, you also need to think about
concurrency.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Database access without using a dataset
user name
2006-06-22 13:06:40
Hi, Kelly

Let me chime in! Why don't you use datareader if you're
only going to read
the records? I believe it's significantly faster than
dataset or standalone
(without building a dataset) datatable. BTW, the latter is
slower, but gives
you more flexibility when manipulating the data later in
your code.

Mark

-----Original Message-----
.... I am going to check out the datareader
solution as well as others that were mentioned, and will let
y'all know how
it turns out.

Thanks,
Kelly

-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On Behalf Of Don
Edwards
Sent: Wednesday, June 21, 2006 11:29 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Database access without using a
dataset

From:    Kelly Baker <kbakerHOWARD-IND.COM>

>I need to access an ODBC database (Connx), running a
single
>query at a time. I DO NOT want to set up or fill a
dataset
>because of the immense size of this database.

That's like saying you don't want a piece of paper because
there are so many trees in the forest.

It is very easy to produce a small dataset by querying a
large
database - just use queries that don't return many rows. It
is
almost as easy to produce a huge dataset by querying a small
database (a few cartesian joins will help here).

>How do I set up a database connection in .Net 2.0 so I
can
>open a connection, run a query on the database, and
close the
>connection, retrieving only the data I am querying for?

You might look at a datareader. The thing with a datareader,
though, is (as I understand it) you can't close or reuse
the
connection until you are through with the data. A connection
is
a rather substantial resource on BOTH ends, and the server
probably has a limited supply of them. A dataset is much
less
resource intensive.

>Every time I try to use the Data Source Wizard, it tries
to set
>up a dataset.

That's excellent. You just need to have a look at how it's
going
to populate that dataset. You want it populated with the
data
you want, not all data in the database.

If you're updating the data, you also need to think about
concurrency.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )