VB6: when inserting by ADO record is not immediately written to database

VB6: when inserting by ADO record is not immediately written to database

Post by Bernd Rosena » Sat, 16 Dec 2000 01:05:31



Hello,

our software in developped in VB6 using ADO components.

When we use a recordset to create new records we sometimes realize
that the new records do not appear immediately in the database.

Is there a way to force the ADO component to immediately write to the
database ?

To my experience, one possible way is to use SQL commands to write to
the database but to change to this in every case we insert to the
database by recordset is too difficult .

Because of ADO not suddenly writting to the database, a check for
double entries in the database fails causing some trouble.

Here is an example on how we write to the table using ADO

 Me.AdodcHeader.Recordset.AddNew

 Me.AdodcHeader.Recordset!anz_pos = 0
 Me.AdodcHeader.Recordset!Ausleiher = isUcase(Trim(NZ(GBenuID)))
Me.AdodcHeader.Recordset!AusleiherAbteilung =
isUcase(Trim(NZ(GDepartment)))
 Me.AdodcHeader.Recordset!Status = "w"

 ..............

 Me.AdodcHeader.Recordset.Update

This check for double values sometimes failed and caused trouble

 Set temprs = DataDB.Execute("select * from Orderheader where
auft_nr='" & isUcase(Trim(NZ(Me.TextListeName.Text))) & "'")

  If Not temprs.EOF Then
            temprs.Close
            MsgBox      

Me.IvFileDictionary1.IvFormat.FormatStr(Me.IvFileDictionary1.Translate("message123"),
                        Me.TextListeName.Text)
            Me.TextListeName.SetFocus
        Else
            temprs.Close

Many thanks in advance for your help,

Regards, Bernd

 
 
 

VB6: when inserting by ADO record is not immediately written to database

Post by Hemo » Sun, 17 Dec 2000 00:26:40


Are you saying that the "Update" command is not updating your database?  The
AddNew command only adds a local (client) record.  The Update command
flushes the current record (be it new or not) out to the provider.  So the
real question would be what provider (aka database) are you using?

You could always do an INSERT SQL command to push the data out the ADO
connection instead of using the AddNew + Update commands.

Not sure why you are using VB code to check for double entries instead of
having the database prevent it (Primary Keys).  I would think it would be
better to prevent something being entered than to have double entries.


Quote:> Hello,

> our software in developped in VB6 using ADO components.

> When we use a recordset to create new records we sometimes realize
> that the new records do not appear immediately in the database.

> Is there a way to force the ADO component to immediately write to the
> database ?

> To my experience, one possible way is to use SQL commands to write to
> the database but to change to this in every case we insert to the
> database by recordset is too difficult .

> Because of ADO not suddenly writting to the database, a check for
> double entries in the database fails causing some trouble.

> Here is an example on how we write to the table using ADO

>  Me.AdodcHeader.Recordset.AddNew

>  Me.AdodcHeader.Recordset!anz_pos = 0
>  Me.AdodcHeader.Recordset!Ausleiher = isUcase(Trim(NZ(GBenuID)))
> Me.AdodcHeader.Recordset!AusleiherAbteilung =
> isUcase(Trim(NZ(GDepartment)))
>  Me.AdodcHeader.Recordset!Status = "w"

>  ..............

>  Me.AdodcHeader.Recordset.Update

> This check for double values sometimes failed and caused trouble

>  Set temprs = DataDB.Execute("select * from Orderheader where
> auft_nr='" & isUcase(Trim(NZ(Me.TextListeName.Text))) & "'")

>   If Not temprs.EOF Then
>             temprs.Close
>             MsgBox

Me.IvFileDictionary1.IvFormat.FormatStr(Me.IvFileDictionary1.Translate("mess
age123"),

- Show quoted text -

Quote:>                         Me.TextListeName.Text)
>             Me.TextListeName.SetFocus
>         Else
>             temprs.Close

> Many thanks in advance for your help,

> Regards, Bernd


 
 
 

1. VB6: when inserting by ADO record is not immediately written to database

Hello,

our software in developped in VB6 using ADO components.

When we use a recordset to create new records we sometimes realize
that the new records do not appear immediately in the database.

Is there a way to force the ADO component to immediately write to the
database ?

To my experience, one possible way is to use SQL commands to write to
the database but to change to this in every case we insert to the
database by recordset is too difficult .

Because of ADO not suddenly writting to the database, a check for
double entries in the database fails causing some trouble.

Here is an example on how we write to the table using ADO

 Me.AdodcHeader.Recordset.AddNew

 Me.AdodcHeader.Recordset!anz_pos = 0
 Me.AdodcHeader.Recordset!Ausleiher = isUcase(Trim(NZ(GBenuID)))
Me.AdodcHeader.Recordset!AusleiherAbteilung =
isUcase(Trim(NZ(GDepartment)))
 Me.AdodcHeader.Recordset!Status = "w"

 ..............

 Me.AdodcHeader.Recordset.Update

This check for double values sometimes failed and caused trouble

 Set temprs = DataDB.Execute("select * from Orderheader where
auft_nr='" & isUcase(Trim(NZ(Me.TextListeName.Text))) & "'")

  If Not temprs.EOF Then
            temprs.Close
            MsgBox      

Me.IvFileDictionary1.IvFormat.FormatStr(Me.IvFileDictionary1.Translate("message123"),
                        Me.TextListeName.Text)
            Me.TextListeName.SetFocus
        Else
            temprs.Close

Many thanks in advance for your help,

Regards, Bernd

2. Insert an image via TParam

3. Strange Behaviour VB6 ADO MSACCESS Added Records do not appear immediately

4. AGAIN: Cannot start Online Engine

5. Select statement

6. I am not able to Sort ADO Hierarchical record set data

7. Stored Procedure Problem

8. Inserting records with VB6 & ADO

9. New and updated rows not appearing immediately following UPDATE or INSERT

10. Insert is not reflecting immediately.....

11. How to write immediately into the database

12. Newly added record not immediately appearing in query