ri*********@hot mail.com (Rick Brandt) wrote in
<bn************ *@ID-98015.news.uni-berlin.de>:
There may in fact be some advantages to ADO in NEW applications
(still waiting for some published data on this), but for a mature
app already fulfilling its requirements using DAO it just seems
like an incredible waste of time to attempt converting it.
Well, that's certainly my thought.
But the reason to use ADO is partly to avoid having to do a lot of
server-side stuff. I'll be administering this SQL Server app, so
that won't really be an issue, but if I can do through ADO what
would take a complex stored procedure in ODBC, maybe it would be
worth it.
In other words, where I'm contemplating replacing the existing
mechanisms with ones appropriate to SQL Server, should I not
contemplate the ADO methods for doing so?
Is there a problem mixing the two in an app, using linked
tables/ODBC in some places and ADO in places where it makes things
easier?
What kind of tasks would those likely be?
I've got a number of issues here:
1a. adding new people currently uses an unbound form that collects
a little data and presents a list of possible matches (to reduce
creation of duplicates; if they don't check for dupes they can't
add the record). My algorithm for evaluating closeness of the match
to what the user puts in is complex and belongs serverside, no
doubt. In thinking it through, I guess I'd really only pass the
WHERE clause that limits results to the close matches and then do
the calculation in Access using my algorithm for evaluating
closeness. I shudder to think about doing that server-side, as the
code is fairly complex. It will only be operating on small numbers
of records (always fewer than 100 or so), so I don't see an issue.
1b. the other part of adding a person is actually doing it. In
Access I open an AppendOnly recordset, add the record, plug in the
values, cache the PK value, save the record, close the recordset,
then open a form with the newly added record loaded. A stored
procedure with input parameters and an output value of the PK would
do this just fine, and will replace the existing code quite easily
(it's already a function that adds the record and returns the PK
value).
2. the main data person entry form is populated through a FIND
function that is based on name, and returns small groups of records
(1-100 or so, usually in the range of 3-10 records). It allows
wildcards so it's not always exact matching (and therefore, often
returning more than just 1 record). I just change the recordsource
for each search. This could surely be done with a passthrough, and
would easily replace the functionality I've already got in place,
simply by altering the SQL that is generated to be a passthrough.
Oops, no a passthrough doesn't work as a form recordsource, no? So,
it would be better as a stored procedure, I guess.
3. in the main data entry form there is a summary calculation of
monies donated that appears at the bottom of the form. Presently
I'm using an in-memory summary recordset that has totals for each
person precalculated and then do some complicated work to update
that (having a custom collection of PKs that have totals that need
to be updated, and requerying the recordset after N additions --
messy, yes, but it improved performance a lot). This could all be
replaced with a stored procedure and would be vastly more efficient
and easy to maintain. I'd have to look into whether it makes more
sense to have return values for the subtotals, or return a
resultset and walk through that to get the values for display.
Since the number of values changes over time, it's probably better
to walk through records (unless a return value can be an array).
4. the main data entry process involves creation of (but hardly any
updating of) child records of the main form. This is presently done
through a bound continuous form list of the child records linked to
an unbound subform that displays the detail. This works just fine,
as the list is noneditable, and the editable form is unbound. It
was complicated to program, though. I could easily rewrite the
retrieval and saving subroutines to operate server-side. I'd have
to decide, though, if I want to operate as I have, with Add doing
nothing but creating a new blank record and then Save updating the
existing record. I could handle that with a single stored
procedure, I guess, simply assigning the input values and if the PK
input value is null, the stored procedure will insert instead of
update. But that leads to a problem, because the OnCurrent of the
list form drives the display of the unbound detail form. I might
have to delink that. It would definitely require some rethinking of
that part of the process.
5. the main form runs a test in the OnCurrent event to check for
possible duplications. If there are possible duplicates, a
collection of the PKs of the possible duplicate records is
populated and a button RECONCILE DUPLICATES is set visible. When
that button is clicked, a form to reconcile the duplicates is
displayed, with two subforms, on the left the main record, on the
right an empty subform that is populated by a listbox at the top
which lists the PKs of the possible dups. It's OnUpdate event
populates the other subform. You can then move all the data from
one to the other (or on individual fields and subforms). I see no
reason why this duplicate reconciliation would not work as is,
since it's loading one record at a time, based on a PK. However,
the code running in the OnCurrent of the main data form would
probably be more efficient with SQL Server, though I'm not sure it
would benefit from anything server-side (could work as a stored
procedure, but probably just as easy to simply not bother).
6. the app includes a complex query-by-form interface that
currently writes data to a temp table. I see no reason to change
that, since the users click on checkmarks in the resultset to make
selections for export, etc. This QBF interface has a complex class
module that constructs the FROM and WHERE clauses dynamically based
on the criteria, and then uses that to construct the SELECT used
for the insert. How would that work in this case? Would I just pass
the dynamic SQL and assume Jet will tell the server to do the
selection and then Jet will do the insert into the temp table? This
is one where I think I'd mostly leave it alone and see if Jet is
smart enough to get it right. I see no reason why it wouldn't as
all the SQL strings are as efficient as they can be in terms of
joins and WHERE clauses. And the criteria are never based on
functions, though a few of them have wildcards (though that's no
issue except for changing the wildcard character).
OK, any comments on those things? They are the ones I can think of
off the top of my head, as somebody who plays around with SQL
Server and reads a lot about it, but hasn't been called upon to
build a full-fledged app with it.
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc