Bug #5840 Double Execution of code
Submitted: 1 Oct 2004 8:49 Modified: 4 Oct 2004 22:24
Reporter: Abyss Abyss Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:4.0.12-nt OS:Windows (WinXP Pro w/ SP2)
Assigned to: Reggie Burnett CPU Architecture:Any

[1 Oct 2004 8:49] Abyss Abyss
Description:
I am getting double excution of code, for any code.

e.g, with an SQL statement of insert I am receiving 2 of the exact same executions
and with a Create table.

How to repeat:

'Create table that makes it happen twice - used in a code behind file.
Imports ByteFX.Data.MySQLClient
Imports System
Imports System.Configuration
Imports System.Web.UI

Public Class Install
	Inherits Page

	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Dim objConn As MySqlConnection
		Dim strCreateTable As String
		Dim cmdInstall As MySqlCommand
		objConn = New MySqlConnection(ConfigurationSettings.AppSettings("strConn"))
		strCreateTable = "CREATE TABLE Clients(" & _
			" ClientID INT AUTO_INCREMENT, "  & _
			" AccountName VARCHAR(255) DEFAULT '', " & _
			" CompanyName VARCHAR(255) DEFAULT '', " & _
			" ABN VARCHAR(100) DEFAULT '', " & _
			" ACN VARCHAR(100) DEFAULT '', " & _
			" ARBN VARCHAR(100) DEFAULT '', " & _
			" FirstName VARCHAR(255) DEFAULT '', " & _
			" LastName VARCHAR(255) DEFAULT '', " & _
			" Title VARCHAR(30) DEFAULT '', " & _
			" WorkNumber VARCHAR(16) DEFAULT '', " & _
			" HomeNumber VARCHAR(16) DEFAULT '', " & _
			" FaxNumber VARCHAR(16) DEFAULT '', " & _
			" MobileNumber VARCHAR(16) DEFAULT '', " & _
			" OtherNumber VARCHAR(16) DEFAULT '', " & _
			" EmailAddress VARCHAR(255) DEFAULT '', " & _
			" AIM VARCHAR(255) DEFAULT '', " & _
			" MSN VARCHAR(255) DEFAULT '', " & _
			" ICQ VARCHAR(12) DEFAULT '', " & _
			" Address VARCHAR(255) DEFAULT '', " & _
			" City VARCHAR(255) DEFAULT '', " & _
			" State VARCHAR(255) DEFAULT '', " & _
			" PostCode VARCHAR(5) DEFAULT '', " & _
			" Country VARCHAR(100) DEFAULT '', " & _
			" BirthDate DATE DEFAULT 19000101, " & _
			" TermsCondAgree BOOL NOT NULL DEFAULT 0, " & _
			" TermsCondAgreeDate VARCHAR(22) NOT NULL, " & _
			" Notes LONGTEXT, " & _
			" PRIMARY KEY(ClientID)) " & _
			" TYPE=InnoDB ROW_FORMAT=DEFAULT;"
		cmdInstall = New MySqlCommand(strCreateTable, objConn)
		objConn.Open()
		cmdInstall.ExecuteNonQuery()
		objConn.Close()
	End Sub
End Class

'this is for the insert sql statement

Imports ByteFX.Data.MySQLClient
Imports Microsoft.VisualBasic
Imports System
Imports System.Configuration
Imports System.Web.UI

Public Class Subscribe
	Inherits Page
	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		If  IsNothing(Request.form("massmail")) Then
			Response.write("This script should be posted too")
		Else
			Dim strAction, strEmailAdress, strSQL As String
			Dim objConn As MySqlConnection
			Dim cmdSubscribe As MySqlCommand

			strAction = Request.Form("action")
		
			strEmailAdress = Replace(Request.Form("email"), "'", "")
			strSQL = "INSERT INTO MassMailAddressList (ClientID, EmailAddress, ConfirmationCode, ConfirmationDate, ConfirmationIP, Category)" & _ 
					"VALUES (1 , 'milk@shake.com', 'asdfg', '2004-10-01', '192.100.100.100', '1');"
			
			
			objConn = New MySqlConnection(ConfigurationSettings.AppSettings("strConn"))			
			cmdSubscribe = New MySqlCommand(strSQL, objConn)
			objConn.Open()
			cmdSubscribe.ExecuteNonQuery()
			objConn.Close()
				
			Try
		
			Catch objException As Exception
				Response.write("Internal Error: <br /><br /> " & objException.ToString())
			End Try
		End If
	End Sub	
End Class

Suggested fix:

It might just be my code, as I used exact code for SQL server as an example, but just placed a My infront eg SqlCommand = MySqlCommand

it works, but some documentation would be cool.

Thanks heaps

Abyss
www.abyss.ws
[3 Oct 2004 9:37] Abyss Abyss
Found the problem to this bug,

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

causes double execution of code where as

Private Sub Page_Load() does not. this is the solution to the problem.
[4 Oct 2004 22:24] Reggie Burnett
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

Thanks.  This has been marked as not a bug.