ERROR IN CREATEUSER METHOD

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

ERROR IN CREATEUSER METHOD

Post by JORGEMAL » Tue 04 Nov 2008 16:06

I am trying to add a user through the membership framework but I am getting an error message. My web.config is configured to accept secret question and answer so I use the overload method that contains the following parameters:

* Username as string
* Password as string
* email as string
* passwordQuestion as string
* passwordAnswer as string
* IsApproved as boolean
* Status as MembershipCreateStatus

Reviewing the "aspnet_membership" table created using the InstallWebTables.sql I see that it contains a field called "isapproved" of type INT which does not correspond to the boolean IsApproved parameter in the CreateUser overloaded method.
All of the field types in the InstallWebFiles.sql (when loaded with the SQL script editor) are in bold type except those of type INT so I guess that such a type does not exist, it gets bold if I change it to INTEGER for example.
Why are boolean types defined as integer?
Is the type INT valid?
There is also a DECIMAL data type in some fields of table aspnet_webevent_events and it is not bold either.

I have tested with a boolean parameter as well as with an integer and the message is the same. In fact, the intellisense tool asks for a True or False value.

What I also did was to change the web.config file and set the requiresQuestionAnswer to false and use the oveload method that accepts username, password and email parameters and I am getting the exact same error message.

I suppose that some fields (in different) tables should be boolean because they indicate a TRUE/FALSE status.

I will appreciate your advice.

The following is the error message I get in the browser when I click the button that calls the CreateUser method.

Server Error in '/e-restdelivery' Application.
--------------------------------------------------------------------------------

invalid input syntax for integer: "False"
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CoreLab.PostgreSql.PgSqlException: invalid input syntax for integer: "False"

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:



or:

2) Add the following section to the configuration file of your application:







Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[PgSqlException (0x80004005): invalid input syntax for integer: "False"]
CoreLab.Common.Web.Providers.DbMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object userId, MembershipCreateStatus& status) +1729

[ProviderException: An exception occurred. Please contact your administrator.]
CoreLab.Common.Web.Providers.DbMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object userId, MembershipCreateStatus& status) +2083
System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +224
System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, MembershipCreateStatus& status) +28
Membresia_NuevoUsuario.btnNuevo_Click(Object sender, EventArgs e) +118
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 05 Nov 2008 10:54

Thank you for the report. We will investigate the issue and will notify you about the results.

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Post by JORGEMAL » Fri 07 Nov 2008 16:38

AndreyR wrote:Thank you for the report. We will investigate the issue and will notify you about the results.
----------------------------------------
Any news about this issue ???
----------------------------------------

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 14 Nov 2008 09:54

We cannot reproduce this issue using dotConnect for PostgreSQL 4.00 and PostgreSQL 8.1.4. Please try using the new version of dotConnect for PostgreSQL. If it doesn't help, specify the PostgreSQL server version you use.

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Post by JORGEMAL » Sat 15 Nov 2008 19:22

Shalex wrote:We cannot reproduce this issue using dotConnect for PostgreSQL 4.00 and PostgreSQL 8.1.4. Please try using the new version of dotConnect for PostgreSQL. If it doesn't help, specify the PostgreSQL server version you use.
------------------------------------------------------------------------------------
Verision of PostgreSQL is 8.3; version of PostgreSQLDirect.NET Pro is 3.75.31.0. I know you just released dotConnect 4.00 for PostgreSQL but I ask you to read the following information for your reference.

I installed and tested Microsoft SQL Server membership database tables and membership framework (everything worked fine this way) and found the following differences compared to Devart tables:
* Table aspnet_users has a field named "isanonymous" defined as BIT in Microsoft tables; Devart script sets it as INT.
* Table aspnet_membership has 2 fields named "isapproved" and "islockedout" defined as BIT in Microsoft tables and INT by Devart.
* BIT datatype corresponds to boolean type, and INT datatype corresponds to INTEGER type.

When writing code to add a user through the Membership.CreateUser method, there are 4 available overloads and I use the one that includes the following 7 parameters:
1. username as string.
2. password as string.
3. email as string.
4. passwordQuestion as string.
5. passwordAnswer as string.
6. isApproved as boolean (and not INT as Devart script specifies).
7. status as System.Web.Security.MembershipCreateStatus.

When I get to enter parameter number 6, Intellisense of Visual Studio 2005 displays 2 options: TRUE and FALSE which are boolean type and not INT type as InstallWebTables.sql script defines.

I guess this is not a matter of PostgreSQL version, I think is has to do with Microsoft standard definition of the Membership.CreateUser method usage which expects a boolean type parameter and not an integer.

I just upgraded to dotConnect 4.00 for PostgreSQL and the first thing I did was to review the InstallWebTables.sql script and there is no change, the 3 fields that are supposed to be boolean remain integer.
Nevertheless, I tested again and tried to add a user and now I get another error message in which I see signs of PostgreSQLDirect.NET 3.75 version:

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'Devart.Data.PostgreSql.Web, Version=3.75.31.0, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. El sistema no puede hallar el archivo especificado.

Source Error:

Line 86:
Line 87:
Line 88:
Line 89:
Line 90:

Source File: C:\e-restdelivery\web.config Line: 88

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Devart.Data.PostgreSql.Web, Version=3.75.31.0, Culture=neutral, PublicKeyToken=09af7300eec23701' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

--------------------------------------------------------------------------------

Besides, after upgrading to dotConnect 4.00 I noticed that .aspx pages containing PgSqlDataSource controls now have a REGISTER ASSEMBLY code line.
I am developing a site in spanish language and I use characters like á, é, í, ó, and ú; after upgrading, all the .aspx pages including the REGISTER ASSEMBLY code line do not display such characters correctly, I need to replace them by their entities; &#225 for á, &#233 for é and so on. Also, the font of some text of the page displayed by the browser was changed. I think that Tools/PostgreSQL/Upgrade Wizard is responsible for this because .aspx pages without PgSqlDataSource controls and without the REGISTER ASSEMBLY code line display correctly.

I understand that software development and upgrade may lead to unexpected results in application behavior, but I please ask you to consider this post and help me achieve the desired results.

Respectfully,
Jorge Maldonado

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 17 Nov 2008 12:24

Actually, "bool" is converted by our provider to "int" in the table. Try setting from your code the "bool" values (as IntelliSense says) and check the appropriate values in the table ("true" should be converted to "1", "false" - "0").

As for the problem with displaying characters, we recommend you to make conversion from the previous version of PostgreSQLDirect .NET to the new version of dotConnect for PostgreSQL manually for those pages where you are encountering these troubles. Just take the old pages (without conversion) and change the namespaces and assembly version to new.

Particularly, assemblies, namespaces, invariant name, and some types were changed as follows:
"CoreLab.Data" became "Devart.Data";
"CoreLab.PostgreSql" became "Devart.Data.PostgreSql";
"PgSqlDirectFactory" became "PgSqlProviderFactory";
Invariant name became "Devart.Data.PostgreSql";
Your projects must be updated to be compatible with dotConnect for PostgreSQL 4.0. Here is the list of files you should update:
*.cs, *.vb - namespaces
*.licx - namespaces and assembly names
Web.config - assembly names and web provider types.

Please notify us on the results.

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Post by JORGEMAL » Tue 18 Nov 2008 16:31

Shalex wrote:Actually, "bool" is converted by our provider to "int" in the table. Try setting from your code the "bool" values (as IntelliSense says) and check the appropriate values in the table ("true" should be converted to "1", "false" - "0").

As for the problem with displaying characters, we recommend you to make conversion from the previous version of PostgreSQLDirect .NET to the new version of dotConnect for PostgreSQL manually for those pages where you are encountering these troubles. Just take the old pages (without conversion) and change the namespaces and assembly version to new.

Particularly, assemblies, namespaces, invariant name, and some types were changed as follows:
"CoreLab.Data" became "Devart.Data";
"CoreLab.PostgreSql" became "Devart.Data.PostgreSql";
"PgSqlDirectFactory" became "PgSqlProviderFactory";
Invariant name became "Devart.Data.PostgreSql";
Your projects must be updated to be compatible with dotConnect for PostgreSQL 4.0. Here is the list of files you should update:
*.cs, *.vb - namespaces
*.licx - namespaces and assembly names
Web.config - assembly names and web provider types.

Please notify us on the results.

I made the necessary changes to upgrade from PostgreSQLDirect to dotConnect and everything is working just fine except the CreateUser method. I did what you told me; I selected TRUE for the "isapproved" parameter (6th parameter in the overload I use) and I am getting the following result; I also used the value 1 and nothing changed.
-----------------------------------------------------------------------------------
invalid input syntax for integer: "False"
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Devart.Data.PostgreSql.PgSqlException: invalid input syntax for integer: "False"

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:



or:

2) Add the following section to the configuration file of your application:







Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[PgSqlException (0x80004005): invalid input syntax for integer: "False"]
Devart.Common.Web.Providers.DbMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object userId, MembershipCreateStatus& status) +1729

[ProviderException: An exception occurred. Please contact your administrator.]
Devart.Common.Web.Providers.DbMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object userId, MembershipCreateStatus& status) +2083
System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +224
System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, MembershipCreateStatus& status) +28
Membresia_NuevoUsuario.btnNuevo_Click(Object sender, EventArgs e) +118
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

-----------------------------------------------------------------------------------



This is the provider definition for the membership, please review it and see if it is OK.
-----------------------------------------------------------------------------------

-----------------------------------------------------------------------------------

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 19 Nov 2008 16:37

Please try creating the tables with the BOOLEAN type for the isanonymous, isapproved and islockedout columns. Does the problem persist in this case? Notify us about the results.

JORGEMAL
Posts: 171
Joined: Thu 03 Jul 2008 23:55

Post by JORGEMAL » Thu 20 Nov 2008 15:42

Shalex wrote:Please try creating the tables with the BOOLEAN type for the isanonymous, isapproved and islockedout columns. Does the problem persist in this case? Notify us about the results.
Yes, it is working now. I made the change to my InstallWebTables.sql permanently.
I appreciate your help and patience.

Post Reply