[thelist] ASP.NET DataGrid Edit/Update problem
Rikter Web Design
support at rikter.com
Tue Jan 31 16:01:34 CST 2006
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>
More information about the thelist
mailing list