locked
Inconsistancy In Storing MemberInfo Table Data? RRS feed

  • Question

  • User-1909038188 posted

    If I run the starter kit and add a user via the application including the FirstName, LastName, etc. it all appears in the MemberInfo table as expected but if I add a new user via the "Website/ASP.NET Configuration" and then run the application, login as that new user, go to "Membership" and enter and save that data, it does not get stored in the MemberInfo table?

    Has anyone else seen this behavior? Any solutions?

    Saturday, February 4, 2006 6:32 AM

All replies

  • User-1346905220 posted

    Wayne-

    I believe this results from the fact that the Website/ASP.NET Configuration only writes to the tables in the ASPNETDB database. The FirstName and LastName are stored in the MemberInfo table in the Club database. The code in the Member_Register page handles adding the new user to both of the databases. One solution could be to add this information as profile information in the ASPNETDB. Of course then you'd have to rewrite the page code to retrieve it from there instead of the MemberInfo table.

    -Mike

    Saturday, February 4, 2006 10:09 PM
  • User-1909038188 posted

    Wayne-

    I believe this results from the fact that the Website/ASP.NET Configuration only writes to the tables in the ASPNETDB database. The FirstName and LastName are stored in the MemberInfo table in the Club database. The code in the Member_Register page handles adding the new user to both of the databases. One solution could be to add this information as profile information in the ASPNETDB. Of course then you'd have to rewrite the page code to retrieve it from there instead of the MemberInfo table.

    -Mike

    Mike;

    Thanks for the response. As I understand the processes, when a new user is created either by the application or by the configuration tool, the aspnetdb tables membership and users are populated (still don't understand why those are two separate tables). If the new user is being created in the application, it then takes the user to the Member_Details page to enter name and such. If a user created via the asp.net configuration tool logs in and uses to the "Membership" link they also go to the Member_Details page and can enter name etc. The problem I am having is that after a user created under the asp.net configuration tool saves their details, if they login again later, that information is not retrieved? The data is not recorded in the MemberInfo table?

    Sunday, February 5, 2006 5:58 AM
  • User-1653776603 posted

    The membership system does not have the fields to store that extra data. Rather than extending the membership system, the app was designed to store the users name, avatar etc in the clubsite database. The code for registering as part of the site, will prompt and request that extra information. The web admin tool knows nothing about it, so it doesn't prompt.

    The update code for member details is probably assuming that there is already a row for the user's details when the update is called. Thus the update to the table is succeeding as far as sql is concerned as no row will match the user id.

    My recommendation would be to write a stored procedure for the update. In it, you would check if the row exists, if not create it, then do the update. You should then be able to map the datasource to use the SP for the update rather than calling update directly.

    Monday, February 6, 2006 12:57 PM
  • User-1346905220 posted

    The membership system does not have the fields to store that extra data. Rather than extending the membership system, the app was designed to store the users name, avatar etc in the clubsite database. The code for registering as part of the site, will prompt and request that extra information. The web admin tool knows nothing about it, so it doesn't prompt.

    The update code for member details is probably assuming that there is already a row for the user's details when the update is called. Thus the update to the table is succeeding as far as sql is concerned as no row will match the user id.

    My recommendation would be to write a stored procedure for the update. In it, you would check if the row exists, if not create it, then do the update. You should then be able to map the datasource to use the SP for the update rather than calling update directly.

    Good idea but you got me thinking so I went back and looked at the code and have another thought. We can check to see how many records were updated. This should be 1 so if that's not the case, we need to insert the user into the MemberInfo table. Make the following changes to the Member_Details.aspx page after the Try on line 25:

    25. Try

    26. Dim Count As Integer = 0

    27. ' Get the number of records updated

    28. Count = da.Update(CType(user.ProviderUserKey, Guid), Addr.Text, Phone.Text, fname.Text, lname.Text, CType(user.ProviderUserKey, Guid))

    29. ' If no records were updated then we need to add the user as a member

    30. If Count <> 1 Then

    31. da.Insert(CType(user.ProviderUserKey, Guid), Addr.Text, Phone.Text, fname.Text, lname.Text)

    32. End If

    I only tried this with one user and it worked. I can't vouch for what other effects may result from this change, but it seems resonably safe. I'll just cover myself by saying that this code is provided "As Is" (you're on your own if you use it).

    -Mike

    Monday, February 6, 2006 8:42 PM