Thursday, 8 August 2013

How to add extra column in aspnet_profile and make modifications in aspnet_Profile_SetProperties?

How to add extra column in aspnet_profile and make modifications in
aspnet_Profile_SetProperties?

I am trying to add extra columns in asp table installed using
aspnet_regsql.exe.
I am adding extra column in aspnet_profile table as causesID and did
changes in the aspnet_Profile_SetProperties by adding additional parameter
as @causesID.
I saw that there is a class named ProfileParameter and i did make use of
that, my code is below,
ProfileParameter objParameter = new ProfileParameter();
objParameter.ConvertEmptyStringToNull = true;
objParameter.DbType = DbType.Int32;
objParameter.Direction = ParameterDirection.Input;
objParameter.Name = "@CausesID";
objParameter.PropertyName = "CausesId";
Here I did adding extra parameter to be passed to
aspnet_Profile_SetProperties. But I'm not sure this is correct or not.
In the stored procedure, i did some changes to installed stored procedure
like this,
@causesID int => for declaration of parameter
Here I added the extra parameter to be added to the aspnet_profile,
UPDATE dbo.aspnet_Profile
SET PropertyNames=@PropertyNames, PropertyValuesString =
@PropertyValuesString,
PropertyValuesBinary = @PropertyValuesBinary,
LastUpdatedDate=@CurrentTimeUtc,CausesID=@CausesID
WHERE UserId = @UserId
INSERT INTO dbo.aspnet_Profile(UserId, PropertyNames,
PropertyValuesString, PropertyValuesBinary, LastUpdatedDate,CausesID)
VALUES (@UserId, @PropertyNames, @PropertyValuesString,
@PropertyValuesBinary, @CurrentTimeUtc,@CausesID)
In the aspnet_profile table, I added a column as causesID.
But it didn't work for me.
Please kindly advise me on that issue.
Thanks in advance..:)

No comments:

Post a Comment