CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP.NET - InMotion Framework

 Before Show event executed twice

Print topic Send  topic

Author Message
AndyGB4

Posts: 122
Posted: 04/15/2013, 2:40 PM

Hi everyone,

I have some code that inserts a record into a database, and it is fired up using the Before Show custom code. But the record is being inserted twice.

So I'm thinking that the page itself must be being called twice. Any reason why this could be happening? The previous page is a custom form that the action equals the page in questions. All the details are being sent through the Post method, and it works successfully on the next page.

View profile  Send private message
Lucius

Posts: 220
Posted: 04/16/2013, 10:57 AM

Before Show should only be called once, unless it's Before Show Row event.

If you get 2 inserts it's most likely error in your code. Add some debugging variables and output to your code and test when your inserts are launched and why.
View profile  Send private message
AndyGB4

Posts: 122
Posted: 04/16/2013, 1:04 PM

Yup, the problem was within my code, I was using executeScalar to get the ID of the last inserted record, but I was unaware that it also executed the query, so I was executing it twice since I also had a executeNonQuery a bit above it.

Problem solved :)

Thanks!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.