Bug #36687 MySql 5.0 Connector/Net 5.2.2 Web Site Administration Tool
Submitted: 13 May 2008 12:31 Modified: 21 May 2008 11:10
Reporter: Michael Krinitsyn Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.2.2 OS:Windows
Assigned to: CPU Architecture:Any

[13 May 2008 12:31] Michael Krinitsyn
Description:
Exception at attempting create user

An exception occurred communicating with the data source.

Action: CreateUser

Exception: MySql.Data.MySqlClient.MySqlException: Column count doesn't match value count at row 1
   at MySql.Data.MySqlClient.MySqlStream.OpenPacket()
   at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
   at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at MySql.Web.Security.MySQLMembershipProvider.CreateUser

How to repeat:
Create user in Web Site Administration Tool

Suggested fix:
Correct Sql Statement:
                    MySqlCommand cmd = new MySqlCommand(
                        @"INSERT INTO my_aspnet_Membership 
                        VALUES(@userId, @email, @comment, @password, @passwordKey, 
                        @passwordFormat, @passwordQuestion, @passwordAnswer, 
                        @isApproved, @lastActivityDate, @lastLoginDate,
                        @lastPasswordChangedDate, @creationDate, 
                        @isLockedOut, @lastLockedOutDate,  @failedPasswordAttemptCount,                       @failedPasswordAttemptWindowStart, @failedPasswordAnswerAttemptCount, 
                        @failedPasswordAnswerAttemptWindowStart)",
                        connection);
[20 May 2008 18:59] Reggie Burnett
I can't repeat this.  Can you double check that you do not have any older versions of the product on your system?  Also, can you try to reproduce with all code using the Membership class?  If you can provide a snippet of code that shows the problem then I'll take another look.
[21 May 2008 11:10] Michael Krinitsyn
I'm using last binaries and sources form downlod page.

Table generated by MySql Connector/Net is

CREATE TABLE  my_aspnet_membership (
  `userId` int(11) default NULL,
  `applicationId` int(11) default NULL,
  `Username` varchar(255) NOT NULL,
  `ApplicationName` varchar(255) NOT NULL,
  `Email` varchar(128) default NULL,
  `Comment` varchar(255) default NULL,
  `Password` varchar(128) NOT NULL,
  `PasswordKey` char(32) default NULL,
  `PasswordFormat` tinyint(4) default NULL,
  `PasswordQuestion` varchar(255) default NULL,
  `PasswordAnswer` varchar(255) default NULL,
  `IsApproved` tinyint(1) default NULL,
  `LastActivityDate` datetime default NULL,
  `LastLoginDate` datetime default NULL,
  `LastPasswordChangedDate` datetime default NULL,
  `CreationDate` datetime default NULL,
  `IsLockedOut` tinyint(1) default NULL,
  `LastLockedOutDate` datetime default NULL,
  `FailedPasswordAttemptCount` int(10) unsigned default NULL,
  `FailedPasswordAttemptWindowStart` datetime default NULL,
  `FailedPasswordAnswerAttemptCount` int(10) unsigned default NULL,
  `FailedPasswordAnswerAttemptWindowStart` datetime default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='2';

I was using autogenerateschema=”true”, but INSERT statement in Connector sources is

                   MySqlCommand cmd = new MySqlCommand(
                        @"INSERT INTO my_aspnet_Membership 
                        VALUES(@userId, @email, @comment, @password,
@passwordKey, 
                        @passwordFormat, @passwordQuestion,
@passwordAnswer, 
                        @isApproved, @lastActivityDate,
@lastLoginDate,
                        @lastPasswordChangedDate, @creationDate, 
                        @isLockedOut, @lastLockedOutDate, 
@failedPasswordAttemptCount,                      
@failedPasswordAttemptWindowStart, @failedPasswordAnswerAttemptCount, 
                        @failedPasswordAnswerAttemptWindowStart)",
                        connection);