Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 31st, 2006, 11:22 PM
Registered User
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview not updating database on Web Host

Hi all,

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, it just doesn't update records in the .mdb file at all. Even tried with SQL Server vs. Access. Same problem.

However, it updates perfectly on localhost. Problem is only on web hosts. Tried different hosts and problem is the same with all of them. Directory and database file permissions on hosts were checked and are not the problem. Code was generated by VS2005.

Live page here: http://www.dickanddeedee.com/pwdtest.aspx

Try changing any of the passwords and you'll see what I mean.

Anyone have any ideas as to what is going on? It seems like a javascript problem from asp.net 2.0? Code from page is below.

Thanks in advance,


<%@ Page Language="VB" CodeFile="pwdtest.aspx.vb" Inherits="pwdtest" %>
<% @Import Namespace="System.Data.OleDb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <form name="form1" id="form1" runat="server">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:apdtConnectionString %>"
            DeleteCommand="DELETE FROM [AdminAccess] WHERE [ID] = @original_ID" InsertCommand="INSERT INTO [AdminAccess] ([Password], [Active]) VALUES (@Password, @Active)"
            SelectCommand="SELECT [ID], [Password], [Active] FROM [AdminAccess]" UpdateCommand="UPDATE [AdminAccess] SET [Password] = @Password, [Active] = @Active WHERE [ID] = @original_ID">
                <asp:Parameter Name="original_ID" Type="Int32" />
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="Active" Type="Boolean" />
                <asp:Parameter Name="original_ID" Type="Int32" />
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="Active" Type="Boolean" />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                <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" />
Old February 1st, 2006, 04:21 PM
Friend of Wrox
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts

I don't know if you have the book Beginning ASP.Net 2.0. If you do, consult
page 225 Chapter 7, 2nd paragraph. It talks about AutoPostBack.
I just happened to read this 5 minutes after having read your topic.

If you do not have the book, I quote from the paragraph above:

"One additional property is of importance for all of the selection lists. AUTOPOSTBACK will automatically post back to the server when the list selection changes. This is critical if there is code in the post back event that you want to execute to reflect the user's selection, such as re-rendering a GridView to show a limited set of records based on the user's selection from a list box."

Hope this help.


Old February 1st, 2006, 04:51 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Are you running a beta version of the .NET framework on your localhost?

If so, check your parameters that start with original_. In the beta timeframe, this was added for concurrency support, but was changed in the final version.

Try removing all the original_ prefixes and see if that helps.

Imar Spaanjaars
Everyone is unique, except for me.
Old February 2nd, 2006, 10:54 PM
Registered User
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

VictorVictor and Imar,

Thanks for responding so quickly. Imar, I examined the code and you're right, it added an original_. I removed that and it works perfectly.

Will also check out Beginning ASP.Net 2.0. Thanks again to you both for such great feedback and exactly the answer I needed.



Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP Web host ironchef Pro JSP 1 December 3rd, 2007 11:47 PM
Updating a gridview control w/access database p3aul ASP.NET 1.0 and 1.1 Professional 0 October 2nd, 2007 06:14 PM
problems with asp database and web host drb2k2 ASP.NET 2.0 Basics 1 May 30th, 2006 03:27 AM
How do I host a web application ? nidhinasthra Classic ASP Basics 1 July 6th, 2005 10:57 AM
Need an Amazing ASP Web Host! Aaron Edwards Classic ASP Basics 1 August 2nd, 2004 01:47 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.