Hello Betty,
Sorry for my delay to come back, because there is a national day in my
country. Now I'm available.
Based on my understanding, the code you used submits twice so that it posts
duplicate new records into the database.
Did you use any additional submit() function in your code besides the form
submit? Maybe some form1.submit() cause the duplicate submit. Please check
it according to this clue. If it can't help you out, please post your codes
in detail or post me the demo application.
Sincerely,
Vince Xu
Microsoft Online Support
--------------------
| Thread-Topic: recordset.addNew
| thread-index: AcnKFYEiCR/9GilzShWt4D4E9iRweQ==
| X-WBNR-Posting-Host: 64.85.242.28
| From: =?Utf-8?B?YzY3NjIyOA==?= <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: RE: recordset.addNew
| Date: Thu, 30 Apr 2009 21:30:06 -0700
| Lines: 130
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.inetserver.asp.general
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.inetserver.asp.general:10235
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
|
| Hi Vince,
|
| It does happen that for some reasons(network communication error,
server's
| slowness, etc), customers would submit twice.
| --
| Betty
|
|
| "Vince Xu [MSFT]" wrote:
|
| > Hello Betty,
| >
| > As far as I known, when calling the AddNew method without arguments,it
sets
| > the EditMode property to adEditAdd (an EditModeEnum value). The
provider
| > caches any field value changes locally. Calling the Update method posts
the
| > new record to the database and resets the EditMode property to
adEditNone
| > (an EditModeEnum value). (The new record will be posted when Update
method
| > is called.)
| > If you pass arguments, ADO immediately posts the new record to the
database
| > (no Update call is necessary); the EditMode property value does not
change
| > (adEditNone).(The new record will be posted directly when AddNew is
called)
| >
| > In logical aspect, these two approaches you listed are different.
| > Based on the approach one, when order_info.EOF is true, it will post a
new
| > record as the approach two does. But if order_info.AddNew is false, it
will
| > update the current record if it calls order_info.Update after these
codes,
| > rather than appending a new record after the recordset. So, I don't
think
| > it will cause duplicated records with this approach, unless it does
submit
| > towice. Maybe other codes cause the duplicated records because of this
| > turbid code structure.
| >
| >
| > Based on the approach two, it will do post a new record to the database
| > clearly if order_info.EOF is true(if you append order_info.Update
before
| > "end if"). I think if you want to add a new record, you can use this
| > approach.
| >
| > If you want to know more about "AddNew", please check the following
| > reference:
| >
http://msdn.microsoft.com/en-us/library/ms677536(VS.85).aspx
| >
| > Sincerely,
| >
| > Vince Xu
| >
| > Microsoft Online Support
| >
| >
| > ==================================================
| > Get notification to my posts through email? Please refer to
| >
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
| >
| > MSDN Managed Newsgroup support offering is for non-urgent issues where
an
| > initial response from the community or a Microsoft Support Engineer
within
| > 2 business day is acceptable. Please note that each follow up response
may
| > take approximately 2 business days as the support professional working
with
| > you may need further investigation to reach the most efficient
resolution.
| > The offering is not appropriate for situations that require urgent,
| > real-time or phone-based interactions. Issues of this nature are best
| > handled working with a dedicated Microsoft Support Engineer by
contacting
| > Microsoft Customer Support Services (CSS) at
| >
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
| > ==================================================
| >
| >
| >
| >
| > --------------------
| > | Thread-Topic: recordset.addNew
| > | thread-index: AcnISwCPDalLj7pKRT6Ht33VTVyi3g==
| > | X-WBNR-Posting-Host: 63.241.246.251
| > | From: =?Utf-8?B?YzY3NjIyOA==?= <
[email protected]>
| > | Subject: recordset.addNew
| > | Date: Tue, 28 Apr 2009 14:48:01 -0700
| > | Lines: 34
| > | Message-ID: <
[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| > | Newsgroups: microsoft.public.inetserver.asp.general
| > | Path: TK2MSFTNGHUB02.phx.gbl
| > | Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.inetserver.asp.general:10218
| > | NNTP-Posting-Host: tk2msftsbfm01.phx.gbl 10.40.244.148
| > | X-Tomcat-NG: microsoft.public.inetserver.asp.general
| > |
| > | Hi all,
| > |
| > | I googled a bit and didn't find good explanation about AddNew method.
so
| > I
| > | post here.
| > | What are the differences between these 2 versions:
| > | 1.
| > |
| > | order_inf

pen cmdTemp, , adOpenKeyset, adLockOptimistic
| > | if order_info.EOF then
| > | order_info.AddNew
| > | end if
| > | order_info("EnrollDate").Value = Now()
| > | order_info("City").Value = Request("City")
| > | order_info("State").Value = Request("State")
| > | order_info("Zip").Value = Request("Zip")
| > | order_info("Email").Value = Request("Email")
| > | ...
| > |
| > | 2.
| > | order_inf

pen cmdTemp, , adOpenKeyset, adLockOptimistic
| > | if order_info.EOF then
| > | order_info.AddNew
| > | order_info("EnrollDate").Value = Now()
| > | order_info("City").Value = Request("City")
| > | order_info("State").Value = Request("State")
| > | order_info("Zip").Value = Request("Zip")
| > | order_info("Email").Value = Request("Email")
| > | end if
| > | ...
| > |
| > | I am wondering whether the 1 version is culprit caused duplicated
records
| > in
| > | the table.
| > | --
| > | Betty
| > |
| >
| >
|