Can't use the automatic UPDATE (SQLDataSource) in GridView for ASPNETDB?!

  • Thread starter Thread starter stockblaster
  • Start date Start date
S

stockblaster

Hello

I am displaying into a GridView the ASPNETDB content (that was created
with the login control of ASP.NET 2.0) why doesn't the SQLDataSource
let me use the UPDATE method..
When i click Advanced on the SQLDataSource configuration those options
are greyed..

Any suggestion? i really need to be able to update the ASPNETDB ....

Regards..
 
The most likely culprit is that the table doesn't have a key on it or the
Select query has a join in it. Can you verify this for me? If you don't
have a key (or if your query has a join in it) then all of the automatic
ways of generating update logic won't work.
 
W.G. Ryan - MVP said:
The most likely culprit is that the table doesn't have a key on it or the
Select query has a join in it. Can you verify this for me? If you don't
have a key (or if your query has a join in it) then all of the automatic
ways of generating update logic won't work.

Hello

Thank you for the reply.
the SELECT statment doesn't have join in.. notice the strange thing that
the table name is vw_aspnet_MembershipUsers (vw?)..
Notice that if i put other table that i have made my self everything
works simple.. i can update easly, but the ASPNETDB thing, nope..
Here is the source:



<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" DataKeyNames="UserId">
<Columns>
<asp:BoundField DataField="UserId" HeaderText="UserId"
SortExpression="UserId" />
<asp:BoundField DataField="PasswordFormat"
HeaderText="PasswordFormat" SortExpression="PasswordFormat" />
<asp:BoundField DataField="MobilePIN" HeaderText="MobilePIN"
SortExpression="MobilePIN" />

**** ETC...****

</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:UserBase %>"
SelectCommand="SELECT * FROM
[vw_aspnet_MembershipUsers]"></asp:SqlDataSource>
 
Onearth - yah, that's the problem. You're accessing a view that's not
intended to be written to - sorry for the bad news.
--------------------------------------
The SQL Server provider database provides several views that enable you to
access the data for a particular feature without accessing the database
tables directly. The views provided are for read access only. You should not
attempt to update the data in the database using the views. All updates
should be made using the .NET Framework classes for each feature.

-------------------------------------------------------
onearth said:
W.G. Ryan - MVP said:
The most likely culprit is that the table doesn't have a key on it or the
Select query has a join in it. Can you verify this for me? If you don't
have a key (or if your query has a join in it) then all of the automatic
ways of generating update logic won't work.

Hello

Thank you for the reply.
the SELECT statment doesn't have join in.. notice the strange thing that
the table name is vw_aspnet_MembershipUsers (vw?)..
Notice that if i put other table that i have made my self everything
works simple.. i can update easly, but the ASPNETDB thing, nope..
Here is the source:



<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" DataKeyNames="UserId">
<Columns>
<asp:BoundField DataField="UserId" HeaderText="UserId"
SortExpression="UserId" />
<asp:BoundField DataField="PasswordFormat"
HeaderText="PasswordFormat" SortExpression="PasswordFormat" />
<asp:BoundField DataField="MobilePIN" HeaderText="MobilePIN"
SortExpression="MobilePIN" />

**** ETC...****

</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:UserBase %>"
SelectCommand="SELECT * FROM
[vw_aspnet_MembershipUsers]"></asp:SqlDataSource>
 
Hello

Thank for your reply.. i am now really disappointed since i will have to
remove all the login controls and do it manually... I must have a
GridView or any Grid View to be able to manage my userbase from the
web... If i knew this before i wouldn't have used the login controls in
the first place...

or i can do this manually? notice that i added a few fields of my own
into the aspnet_Membership.
 
Back
Top