I am getting error because of below line
//MembershipUser currentuser =
obj.GetUser(username, false);
Provide your authentication provider name as shown
below
MembershipUser currentUser = Membership.Providers["RSCMemberProvider"].GetUser(username,
false);
Guid newUserId = (Guid)currentUser.ProviderUserKey;
//string updateUserSql = "UPDATE
aspnet_Users SET " + field + " = '" + value + "' WHERE
UserId= '" + key + "'";
string FirstName = ((TextBox)(RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txtFirstName"))).Text.Trim();
string LastName = ((TextBox)(RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txtLastName"))).Text.Trim();
string updateUserSql = "UPDATE aspnet_Users SET FirstName='" +
FirstName +"', lastname='" +
LastName + "' WHERE UserId='" +
newUserId + "'";
Response.Write(updateUserSql);
using (SqlConnection
dbConnection = new SqlConnection(connectionString))
{
dbConnection.Open();
SqlCommand comd = new SqlCommand(updateUserSql, dbConnection);
comd.ExecuteNonQuery();
dbConnection.Close();
}
Thanks alot. It works for me.
ReplyDelete