[thelist] ASP.NET DataGrid Edit/Update problem

Rikter Web Design support at rikter.com
Wed Feb 1 12:08:36 CST 2006


Hi Tab/Asif,

Thanks for your suggestions and assistance.  I finally figured it out.  

Traced problem to Visual Studio 2005: VS2005 was placing the following code
on the page when dropping the datagrid:

            <UpdateParameters>
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="Active" Type="Boolean" />
                <asp:Parameter Name="original_ID" Type="Int32" />
            </UpdateParameters>


The Visual Web Developer Express version of Visual Studio 2005 puts the
following code on the same page page with exact same controls for the
datagrid:

            <UpdateParameters>
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="Active" Type="Boolean" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>

When I remove the 'original_ID' and change to just 'ID', it works perfectly.


Thanks again,

Christopher



-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Tab Alleman
Sent: Wednesday, February 01, 2006 6:59 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] ASP.NET DataGrid Edit/Update problem

Have you verified connectivity/permission from the web host to the database
by other scripts?

For instance, if you write an ASP.NET script with a simple ad-hoc INSERT
statement in it, and execute the script from the web host, does the row get
inserted in the database as expected?


> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Rikter Web Design
> Sent: Tuesday, January 31, 2006 8:14 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] ASP.NET DataGrid Edit/Update problem
> 
> 
> Hi Asif,
> 
> Thanks for responding. Permissions are ok.  Even copied web files to a 
> different web host and still same problem.  Even tried with SQL Server 
> vs.
> Access.  Same problem.
> 
> Code was generated by VS2005.  Works perfectly on localhost.
> 
> I checked again and don't see anything wrong with the postback, as 
> it's functioning properly everywhere except on all the various web 
> hosts.  One of the web hosts I tried, hostmysite.com, told me the code 
> was incorrect---but of course not how it was incorrect.  But since it 
> works perfectly on localhost, and generated with VS2005, I can't 
> figure out what the problem can be.
> 
> Google is useless because I've not found anyone on internet with this 
> same problem.  It's the damnest thing.  I just don't get it.
> 
> Chris
> 
> 
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Asif Suria
> Sent: Tuesday, January 31, 2006 2:59 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] ASP.NET DataGrid Edit/Update problem
> 
> 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 !
> 
-- 

* * 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 ! 




More information about the thelist mailing list