.addnew method ADO does not work pls help 
Author Message
 .addnew method ADO does not work pls help

I am writing an app in Vb6 using ADO to connect and manipulate data stored
on a SQLserver 7
I wrote a procedure to add a record to a table using the .addnew method of
the recordset
The procedure runs without a hitch but does not create any records what so
ever.
Has anyone got any good ideas?

Many thanks in advance.

Code:

With adorsBilag

.Open "SELECT * FROM bilag", , adOpenDynamic, adLockBatchOptimistic,
adCmdText

.AddNew

!bilagtype = cboBilagtype.ListIndex - 1
!bilagansvarlig = cbobilagansvarlig.ListIndex - 1
!bilagst?rrelse = Val(txtBilagst?rrelse)
!bilagdato = Format(dtpBilagdag.Value, "m/d/yy")
!bilagoppgj?rid = 1

If chkKontant = vbChecked Then

    !bilagkontant = True

    Else

   !bilagkontant = False

End If

.Update

.Close

End With



Sun, 17 Mar 2002 03:00:00 GMT  
 .addnew method ADO does not work pls help
Did you use the Update method after assigning your fields?



Quote:
> I am writing an app in Vb6 using ADO to connect and manipulate data stored
> on a SQLserver 7
> I wrote a procedure to add a record to a table using the .addnew method of
> the recordset
> The procedure runs without a hitch but does not create any records what so
> ever.
> Has anyone got any good ideas?

> Many thanks in advance.

> Code:

> With adorsBilag

> .Open "SELECT * FROM bilag", , adOpenDynamic, adLockBatchOptimistic,
> adCmdText

> .AddNew

> !bilagtype = cboBilagtype.ListIndex - 1
> !bilagansvarlig = cbobilagansvarlig.ListIndex - 1
> !bilagst?rrelse = Val(txtBilagst?rrelse)
> !bilagdato = Format(dtpBilagdag.Value, "m/d/yy")
> !bilagoppgj?rid = 1

> If chkKontant = vbChecked Then

>     !bilagkontant = True

>     Else

>    !bilagkontant = False

> End If

> .Update

> .Close

> End With



Thu, 21 Mar 2002 03:00:00 GMT  
 .addnew method ADO does not work pls help
Quote:

>I am writing an app in Vb6 using ADO to connect and manipulate data stored
>on a SQLserver 7
>I wrote a procedure to add a record to a table using the .addnew method of
>the recordset
>The procedure runs without a hitch but does not create any records what so
>ever.
>Has anyone got any good ideas?

>Many thanks in advance.

>Code:

>With adorsBilag

>..Open "SELECT * FROM bilag", , adOpenDynamic, adLockBatchOptimistic,
>adCmdText

>..AddNew

>!bilagtype = cboBilagtype.ListIndex - 1
>!bilagansvarlig = cbobilagansvarlig.ListIndex - 1
>!bilagst?rrelse = Val(txtBilagst?rrelse)
>!bilagdato = Format(dtpBilagdag.Value, "m/d/yy")
>!bilagoppgj?rid = 1

>If chkKontant = vbChecked Then

>    !bilagkontant = True

>    Else

>   !bilagkontant = False

>End If

>..Update

>..Close

>End With

Probably because you're using adLockBatchOptimistic.  In batch update mode you
have to do an .updatebatch command instead of just a .update command.   Change
it to adLockOptimistic and it should work.


Sat, 30 Mar 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. AddNew/REquery method of ADO Recordset not Working?

2. POST method NOT WORKING... pls help

3. AddNew method does not work

4. AddNew Method not working for me anymore.

5. Addnew and update method in ADOCE not working ?

6. ADO, Identity in SQL 6.5, AddNew, not working...

7. Find method in Ado...pls help...

8. What is AddNew method doing

9. ADO + Access97: please help with AddNew-Method

10. select into sql statement not working - pls help

11. NetFileClose is not working...pls help!!

12. Recordset.AddNew not working Help

 

 
Powered by phpBB® Forum Software