I have a custom profile table in this DNN instance that I am trying to populate from the DNN UserProfile data using the DNNProfileInfo function in a trigger on the sql database. The problem seems to be that the Profile table simply in NOT being populated with the new information from the DNN registrations form. Here is the chain of events:
- A user fills the registration form and captcha
- Clicks the registration button
- Gets an error that the registration in not available.
I log in as administrator:
- I check the event log and see that the trigger tried to fire, but a required column is null so the insert fails.
- I check the user accounts and see that the user has been created.
- I click 'Manage Profile' of the user and discover that there is no profile data recorded.
- I am inserting the event log data and the trigger used and hope that someone might see what the error could be.
SQL SERVER 2008R2 TRIGGER on UserProfile Table:
ALTER TRIGGER [dbo].[trig_FamilyProfile]
ON [dbo].[UserProfile]
AFTER INSERT
AS
Begin
SET NOCOUNT ON
INSERT INTO dbo.jtp_Adult(UserID, FirstName, LastName, Gender, Birthdate, Email, Phone1, Phone2, TextMsg, City, State)
SELECT dbo.Users.UserID, dbo.initCap(dbo.Users.FirstName)AS FirstName, dbo.initCap(dbo.Users.LastName) AS LastName, dbo.initCap(dbo.DNNProfileInfo(dbo.Users.UserID, N'Gender')) AS Gender,
dbo.initCap(dbo.DNNProfileInfo(dbo.Users.UserID, N'Birthdate')) AS Birthdate, dbo.Users.Email, dbo.StandardPhone(dbo.DNNProfileInfo(dbo.Users.UserID, N'Phone1')) AS Phone1, dbo.StandardPhone(dbo.DNNProfileInfo(dbo.Users.UserID, N'Phone2')) AS Phone2,
dbo.initCap(dbo.DNNProfileInfo(dbo.Users.UserID, N'TextMsg'))AS TextMsg, dbo.initCap(dbo.DNNProfileInfo(dbo.Users.UserID, N'City')) AS City, dbo.initCap(dbo.DNNProfileInfo(dbo.Users.UserID, N'Region')) AS State
FROM inserted INNER JOIN dbo.Users On inserted.UserID = dbo.users.UserID
End
TRACE INFO FROM EVENT LOG:
AssemblyVersion: 6.1.3
PortalID: 0
PortalName:
UserID: -1
UserName:
ActiveTabID: 41
ActiveTabName: Home
RawURL:
AbsoluteURL: /Default.aspx
AbsoluteURLReferrer:
UserAgent:
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: aec702b5-0faa-4216-9d45-cb3d4c869c35
InnerException: Cannot insert the value NULL into column 'Gender', table 'garlandtenniscenter.garlandtennisce.jtp_Adult'; column does not allow nulls. INSERT fails. The statement has been terminated.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Data.SqlClient.SqlConnection.
StackTrace:
Message: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'Gender', table 'garlandtenniscenter.garlandtennisce.jtp_Adult'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection. (SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection. (SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) at DotNetNuke.Security.Membership.Data.SqlDataProvider.UpdateProfileProperty(Int32 profileId, Int32 userId, Int32 propertyDefinitionID, String propertyValue, Int32 visibility, DateTime lastUpdatedDate) at DotNetNuke.Security.Profile.DNNProfileProvider.UpdateUserProfile(UserInfo user) at DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(UserInfo user) at DotNetNuke.Security.Membership.AspNetMembershipProvider.CreateUser(UserInfo& user)