Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 28th, 2010, 03:11 PM
Registered User
Join Date: May 2010
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default Problem with updating database based on user input

Let me explain what i am trying to do.

I am creating a number of webforms that allow a building manager to receive forms from managers requesting for equipment, offices, etc for new employees or existing employees. In one webform the building manager can click a GetForm button that will get the information from a MS Access Database and show the form with all the data filled out based on what was saved by a manager. If the building manager wants to change something he clicks a button to enable all the controls and can change any textbox or checkbox on the page. After that he/she clicks an Update button that calls a function that grabs the params and updates the database. However when update is clicked nothing is updated but no errors are thrown. In MS Access I tested the query and it works. What could i be missing?

Source Page(edited out some params to make more readable):
                <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/aDatabase.mdb" 
        SelectCommand="SELECT * FROM [Requests]"
        UpdateCommand="UPDATE [Requests] SET [Requester Name] = ?, //...some 60 params later [Special Instructions] = ? WHERE [ID] = ?">
            <asp:FormParameter Name="Requester Name"  />
              //...some 60 params later
            <asp:FormParameter Name="Special Instructions"  />
            <asp:Parameter Name="ID"  />
Code Behind Update Button Click:
    protected void btn_update_Click(object sender, EventArgs e)
        GridView1.Enabled = false;

        string eN = Request.QueryString["form"];
        string dE = decryptQueryString(eN);

        AccessDataSource1.UpdateParameters["Requester Name"].DefaultValue = txb_rqstname.Text;
        AccessDataSource1.UpdateParameters["Special Instructions"].DefaultValue = txbx_SpecialInstructions.Text;
        AccessDataSource1.UpdateParameters["ID"].DefaultValue = dE;

        for (int x = 0; x < 60; x++)
            //debug       Response.Write(AccessDataSource1.UpdateParameters[x].DefaultValue + " ");

  #2 (permalink)  
Old May 28th, 2010, 06:26 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

Two things you could look into:

1. Do very simply updates work? That is, are you sure you can write to the database?

2. Is the WHERE clause OK? Do you assign it a valid ID?

3. Do all your parameters match? Because of the index based nature of Access queries you may have missed one and never assign the ID.....


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
b_clodius (June 1st, 2010)
  #3 (permalink)  
Old June 1st, 2010, 12:10 PM
Registered User
Join Date: May 2010
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts

Woohoo I got it!

Thanks for the suggestions Imar, i had already done them but did them again, after further investigation and realization that nothing was changing i fixed the PageLoad event by wrapping all the code in a !PostBack and that did the trick.

Thanks again

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Updating MS Access database javlet Java Databases 1 April 24th, 2007 07:16 AM
Problem getting updating Database from Datagrid RichardP ASP.NET 1.0 and 1.1 Basics 0 February 17th, 2006 07:55 AM
updating the user database ali786 Classic ASP Databases 1 March 11th, 2005 05:04 AM
Updating Database Problem m4r7in PHP Databases 3 December 20th, 2004 12:01 PM
updating database problem nazra Classic ASP Databases 10 July 25th, 2003 08:27 PM

All times are GMT -4. The time now is 11:39 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.