[thelist] ASP.NET DataGrid Edit/Update problem
Asif Suria
asifsuria at yahoo.com
Tue Jan 31 16:59:19 CST 2006
Check out the second argument for the update link. I
think the ID is not getting passed to the page during
postback.
Another thing to check into is the permissions on the
database/table to make sure that web users can write
or update to it.
Asif
---------------------------------------------------------------
If the doors of perception were cleansed everything
would appear to man as it is, infinite. William
Blake.
Yes, I am blogging @
http://www.sinletter.com/ablog.aspx
--- Rikter Web Design <support at rikter.com> wrote:
> Hi all,
>
> Tearing hair out over this one. Inserted an ASP.NET
> Gridview on page with
> edit ability to update an Access database. When I
> go to make edit, no error
> message occurs, just doesn't update records at all.
>
> Works perfectly on localhost. Problem is only when
> on web hosts, but tried
> two different hosts and problem is the same with
> both. Permissions on hosts
> were checked.
>
> Live page here:
> http://www.dickanddeedee.com/pwdtest.aspx
>
> Try changing any of the passwords and you'll see
> what I mean.
>
> Chris
>
>
> Code:
>
> <%@ Page Language="VB" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
>
> <script runat="server">
>
> Protected Sub AccessDataSource1_Selecting(ByVal
> sender As Object, ByVal
> e As
>
System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs)
>
> End Sub
> </script>
>
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:AccessDataSource ID="AccessDataSource1"
> runat="server"
> DataFile="~/fpdb/listdata.mdb"
> DeleteCommand="DELETE FROM [AdminAccess]
> WHERE [ID] = ?"
> InsertCommand="INSERT INTO [AdminAccess] ([ID],
> [Password], [Active]) VALUES
> (?, ?, ?)"
> SelectCommand="SELECT [ID], [Password],
> [Active] FROM
> [AdminAccess] WHERE ([AccessLevel] = ?)"
> UpdateCommand="UPDATE [AdminAccess] SET
> [Password] = ?, [Active]
> = ? WHERE [ID] = ?"
> OnSelecting="AccessDataSource1_Selecting">
> <DeleteParameters>
> <asp:Parameter Name="original_ID"
> Type="Int32" />
> </DeleteParameters>
> <UpdateParameters>
> <asp:Parameter Name="Password"
> Type="String" />
> <asp:Parameter Name="Active"
> Type="Boolean" />
> <asp:Parameter Name="original_ID"
> Type="Int32" />
> </UpdateParameters>
> <SelectParameters>
> <asp:Parameter DefaultValue="2"
> Name="AccessLevel"
> Type="Int32" />
> </SelectParameters>
> <InsertParameters>
> <asp:Parameter Name="ID"
> Type="Int32" />
> <asp:Parameter Name="Password"
> Type="String" />
> <asp:Parameter Name="Active"
> Type="Boolean" />
> </InsertParameters>
> </asp:AccessDataSource>
>
> </div>
> <asp:GridView ID="GridView1" runat="server"
> AllowSorting="True"
> AutoGenerateColumns="False"
> DataKeyNames="ID"
> DataSourceID="AccessDataSource1">
> <Columns>
> <asp:CommandField
> ShowEditButton="True" />
> <asp:BoundField DataField="ID"
> HeaderText="ID"
> InsertVisible="False" ReadOnly="True"
> SortExpression="ID" />
> <asp:BoundField DataField="Password"
> HeaderText="Password"
> SortExpression="Password" />
> <asp:CheckBoxField
> DataField="Active" HeaderText="Active"
> SortExpression="Active" />
> </Columns>
> </asp:GridView>
> </form>
> </body>
> </html>
>
> --
>
> * * Please support the community that supports you.
> * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip
> Harvester
> and archives of thelist go to:
> http://lists.evolt.org
> Workers of the Web, evolt !
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the thelist
mailing list