Re: Duplicate Record with .ADDNEW
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Sat, 11 Nov 2006 19:34:07 -0600
<mamin@xxxxxxxxxxxxxxxxx> wrote in message
news:1163291509.231486.212700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ralph,
Thank you for details. I have changed code to following:
============================================
OrderitemsSQl = "Insert into tblOrderitems (Orderid,productid,
qty,priceperunit,Giftwrap,AmazonOrderItemCode,GiftWrapType) values "
OrderitemsSQl = OrderitemsSQl & "(" & pOrderID & ", '" & pProductID &
"'," & pQuantity & "," & pPricePerUnit & ","
OrderitemsSQl = OrderitemsSQl & "'" & pGiftWrap & "'," &
pAmazonOrderItemCode & ",'" & pGiftWrapType & "');"
OrderitemsSQl = OrderitemsSQl & "SELECT @@IDENTITY;"
'Debug.Print OrderitemsSQl
Set rsOrderItems = ConnOrder.Execute(OrderitemsSQl).NextRecordset
pOrderItemsID = rsOrderItems(0)
=======================================
It is replaced ADDNEW and .UPDATE Method.
After above change problem still exists. After your answer I notices
that
LOCAL had Provider=SQLOLEDB
and
Server had Provider=SQLOLEDB.1
I have made changes to Provider=SQLOLEDB to server to see if problem
still exist. I will let you know if this fixes this issue. If you have
any thought which I can try please let me know. I like to try all
possibility to resolve this logic.
I agree that server became more busier than ever due to holiday season
but I can't imagine that there is no solution.
Thanks
Manoj
I'm am a bit astonished at the moment. Whenever one reports 'strange'
behavior and a '*" or AddNew/Update is present - specifying fields and
changing to a more straightforward method (Insert/Update statements) always
'fixed' the problem.
However, I wouldn't use the Connection.Execute method. There is no reason to
return a recordset. Use the Command object instead.
Anyway, you can be sure that the Insert Statement by itself can't create a
duplicate record. Are you sure the routine is called only once?
I think you need to show more code.
As for SQLOLEDB and SQLOLEDB.1 - the '.1' is just a version number. The
first use says use any version, the latter says use only this version. By
differences in Providers - I meant extreme differences as in using "OLEDB"
in one case and "OLE DB for ODBC" in another. I doubt there is that kind of
difference in these two versions.
-ralph
.
- Follow-Ups:
- Re: Duplicate Record with .ADDNEW
- From: Mark McGinty
- Re: Duplicate Record with .ADDNEW
- From: mamin
- Re: Duplicate Record with .ADDNEW
- From: Henning
- Re: Duplicate Record with .ADDNEW
- References:
- Duplicate Record with .ADDNEW
- From: mamin
- Re: Duplicate Record with .ADDNEW
- From: JP Bless
- Re: Duplicate Record with .ADDNEW
- From: mamin
- Re: Duplicate Record with .ADDNEW
- From: mamin
- Re: Duplicate Record with .ADDNEW
- From: Ralph
- Re: Duplicate Record with .ADDNEW
- From: mamin
- Duplicate Record with .ADDNEW
- Prev by Date: Re: Duplicate Record with .ADDNEW
- Next by Date: Re: Duplicate Record with .ADDNEW
- Previous by thread: Re: Duplicate Record with .ADDNEW
- Next by thread: Re: Duplicate Record with .ADDNEW
- Index(es):
Relevant Pages
|