Re: Smartest way toa add records manually
- From: "ZRexRider" <jerryg@xxxxxxx>
- Date: 28 May 2005 03:27:33 -0700
So what's your favorite philosophy?
I've always been old-school in that I either developed a class module
or dozens of specific stored procs for Add, Update, Delete to support
all tables (trying to keep SQL from being sprinkled all over my
project). However, ADO and MS Access GUI make it so easy to tie SQL to
objects or do stuff on the fly I find myself starting to get sloppier.
I find it difficult to teach others to "black box" the SQL code because
it looks so tedius.
Heck I didn't even know that you could do what Alex pointed out:
currentproject.connection.execute("Delete from TblTest Where
Test_ID=1")
me.requery
Now I'm really in trouble!
I've spent years developing VB6/Oracle DB interfaces (using Oracle
Objects for Ole instead of ADO) and never had SQL in the User interface
code. But now I find it silly to develop a stored proc to load a list
box.
I guess my question is - do most of you continue to separate the SQL
from the interface or has the power of ADO lured you into blending?
Thanks
Robert Morley wrote:
> Alex makes a number of good points, though there's something to be said for
> the simplicity of a one-line "INSERT..." statement.
>
> If you DO decide to use an INSERT statement of this style (which I find
> faster than anything else when you're strictly adding new data and don't
> care about running a corresponding SELECT statement, or the timing issues
> Alex mentioned), you may also want to consider pre-generating a string with
> several INSERT statements in a row, separated by CR/LF's.
>
> Personally, I use an admixture, depending on the nature of what I'm doing.
> When I'm not doing a blind insert, the best method I've found to-date is to
> use a client-side cursor with the adLockBatchOptimistic option, and let ADO
> take care of everything after that. Client-side cursors do have a few
> limitations, however, like the inability to read back values in identity
> fields and calculated fields, if that's a concern. (And if I'm wrong in
> that, somebody PLEASE tell me how, cuz I haven't found a way so far.)
>
>
>
> Rob
>
> "Atlas" <atlaspeak@xxxxxxxxxxx> wrote in message
> news:119e02ig4l9ddbf@xxxxxxxxxxxxxxxxxxxxx
> > Access 2003 (SP1) + .adp project + ADO 2.8 + MS Sql Server 2000
> >
> > I'm wondering if in a VBA code script it is more efficient & faster adding
> > records using a cn.execute(--INSERT-STATEMENT) or if it is better to open
> > a connection and then rs.addnew + rs.update, considering that the latter
> > needs a SELECT statement before issueing the addnew+update (what if
> > millions records? Need to fecth only a few just to open the recordset).
> >
> > Comments appreciated
> >
.
- References:
- ADO: Smartest way toa add records manually
- From: Atlas
- Re: Smartest way toa add records manually
- From: Robert Morley
- ADO: Smartest way toa add records manually
- Prev by Date: Disconnect connection to SQL Server
- Next by Date: Re: ADE Write Conflicts
- Previous by thread: Re: Smartest way toa add records manually
- Next by thread: GOOD
- Index(es):
Relevant Pages
|