Home All Groups Group Topic Archive Search About

uniqueidentifier and updating record

Author
2 Dec 2005 6:39 PM
Al
Hi,
I am using the GridView control to display membership info.  However I
cannot get it to update a record.  I think the issue has to do with
uniqueidentifier and have tried some things I found around the Internet to no
avail.  The UserId is a GUID and a SQL trace shows a NULL in the update.  Any
ideas?

Thanks very much.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSourceUserMgnt" AllowPaging="True" AllowSorting="True"
PageSize="8" >
        <Columns>
          <asp:CommandField ShowEditButton="True" />
          <asp:BoundField DataField="UserId" HeaderText="UserId"
ReadOnly="True" SortExpression="UserId" />
          <asp:BoundField DataField="UserName" HeaderText="UserName"
ReadOnly="True" SortExpression="UserName" />
          <asp:BoundField DataField="Email" HeaderText="Email"
SortExpression="Email" />
          <asp:BoundField DataField="LoweredUserName"
HeaderText="LoweredUserName" ReadOnly="True" SortExpression="LoweredUserName"
/>
          <asp:BoundField DataField="LastActivityDate"
HeaderText="LastActivityDate" ReadOnly="True"
SortExpression="LastActivityDate" />
        </Columns>
      </asp:GridView>
      <asp:SqlDataSource ID="SqlDataSourceUserMgnt" runat="server"
ConnectionString="<%$ ConnectionStrings:aspnetdbConnectionString %>"
        SelectCommand="SELECT aspnet_Users.UserId, aspnet_Users.UserName,
aspnet_Users.LoweredUserName, aspnet_Users.LastActivityDate,
aspnet_Membership.Password, aspnet_Membership.MobilePIN,
aspnet_Membership.Email, aspnet_Membership.LoweredEmail,
aspnet_Membership.PasswordQuestion, aspnet_Membership.PasswordAnswer,
aspnet_Membership.IsApproved, aspnet_Membership.IsLockedOut,
aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate,
aspnet_Membership.LastPasswordChangedDate, aspnet_Membership.LastLockoutDate,
aspnet_Membership.FailedPasswordAttemptWindowStart,
aspnet_Membership.FailedPasswordAnswerAttemptCount,
aspnet_Membership.FailedPasswordAttemptCount,
aspnet_Membership.FailedPasswordAnswerAttemptWindowStart,
aspnet_Membership.Comment FROM aspnet_Users INNER JOIN aspnet_Membership ON
aspnet_Users.UserId = aspnet_Membership.UserId"
        UpdateCommand="UPDATE [aspnet_Membership] SET [Email] = @Email WHERE
[UserId] = @UserId">
        <UpdateParameters>
          <asp:Parameter Name="UserId" />
          <asp:Parameter Type="String" Name="Email" />
        </UpdateParameters>
      </asp:SqlDataSource>

--
Thanks,
Al Smith

Author
22 Dec 2005 8:29 PM
beaudetious
Al,

I was wondering if you had any luck on this.  I'm going through some of the
same issues (but attempting to put the Roles functionality into a gridview)
and I'm stuck. 

Beaudetious

Show quoteHide quote
"Al" wrote:

> Hi,
> I am using the GridView control to display membership info.  However I
> cannot get it to update a record.  I think the issue has to do with
> uniqueidentifier and have tried some things I found around the Internet to no
> avail.  The UserId is a GUID and a SQL trace shows a NULL in the update.  Any
> ideas?
>
> Thanks very much.
>
> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
> DataSourceID="SqlDataSourceUserMgnt" AllowPaging="True" AllowSorting="True"
> PageSize="8" >
>         <Columns>
>           <asp:CommandField ShowEditButton="True" />
>           <asp:BoundField DataField="UserId" HeaderText="UserId"
> ReadOnly="True" SortExpression="UserId" />
>           <asp:BoundField DataField="UserName" HeaderText="UserName"
> ReadOnly="True" SortExpression="UserName" />
>           <asp:BoundField DataField="Email" HeaderText="Email"
> SortExpression="Email" />
>           <asp:BoundField DataField="LoweredUserName"
> HeaderText="LoweredUserName" ReadOnly="True" SortExpression="LoweredUserName"
> />
>           <asp:BoundField DataField="LastActivityDate"
> HeaderText="LastActivityDate" ReadOnly="True"
> SortExpression="LastActivityDate" />
>         </Columns>
>       </asp:GridView>
>       <asp:SqlDataSource ID="SqlDataSourceUserMgnt" runat="server"
> ConnectionString="<%$ ConnectionStrings:aspnetdbConnectionString %>"
>         SelectCommand="SELECT aspnet_Users.UserId, aspnet_Users.UserName,
> aspnet_Users.LoweredUserName, aspnet_Users.LastActivityDate,
> aspnet_Membership.Password, aspnet_Membership.MobilePIN,
> aspnet_Membership.Email, aspnet_Membership.LoweredEmail,
> aspnet_Membership.PasswordQuestion, aspnet_Membership.PasswordAnswer,
> aspnet_Membership.IsApproved, aspnet_Membership.IsLockedOut,
> aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate,
> aspnet_Membership.LastPasswordChangedDate, aspnet_Membership.LastLockoutDate,
> aspnet_Membership.FailedPasswordAttemptWindowStart,
> aspnet_Membership.FailedPasswordAnswerAttemptCount,
> aspnet_Membership.FailedPasswordAttemptCount,
> aspnet_Membership.FailedPasswordAnswerAttemptWindowStart,
> aspnet_Membership.Comment FROM aspnet_Users INNER JOIN aspnet_Membership ON
> aspnet_Users.UserId = aspnet_Membership.UserId"
>         UpdateCommand="UPDATE [aspnet_Membership] SET [Email] = @Email WHERE
> [UserId] = @UserId">
>         <UpdateParameters>
>           <asp:Parameter Name="UserId" />
>           <asp:Parameter Type="String" Name="Email" />
>         </UpdateParameters>
>       </asp:SqlDataSource>
>
> --
> Thanks,
> Al Smith