Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3274576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:03:13+00:00 2026-05-17T19:03:13+00:00

On my page, whenever a DetailsView is updated, I must audit the changes into

  • 0

On my page, whenever a DetailsView is updated, I must audit the changes into a database. On most pages this works perfect, as there were just textboxes – however on a page I am working on right now, with dropdownlists, my code isn’t working.

Basically, what the code does is captures the Updating event of the SqlDataSource, creates a datareader to look at the contents of the row before it’s updated, compares the contents to the parameters in the Update query of the SqlDataSource, and if one has changed to log this in a field in the Audit table. An extract of my code is below:

while (reader.Read())
            {
                for (int i = 0; i < reader.FieldCount; i++)
                {
           try {
                        if (reader[i].ToString() != e.Command.Parameters[i].Value.ToString())
                        {
                            fields[i] = reader.GetName(i) + ": " + reader[i].ToString() + " => " + e.Command.Parameters[i].Value.ToString();
                        }
           }
                    catch {
                        if (reader[i].ToString() != "")
                        {
                            fields[i] = reader.GetName(i) + ": " + reader[i].ToString() + " => ";
                        }
                    }


                }
            }

When the control is on a dropdownlist, it seems to never go ‘into’ the IF even though the fields are different. Do I need to do something special to compare the values of dropdownlists? Note I believe the value is stored as an int in my table.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:03:14+00:00Added an answer on May 17, 2026 at 7:03 pm

    Totally my fault. There was an extra parameter on the command which I had to exclude somehow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi :) I've ran into a bit of a trouble. (short-form: whenever the page
I have an application that requires a page refresh whenever the orientation changes (ipad/iphone).
I want my web page to beep whenever a user exceeds the maximum character
So whenever I click the button on the startup page, it gives me a
Whenever I entered URL for opening a jsp page ..i am getting The requested
Whenever I load ONLY the 1.3 or 1.4 library on an html page im
I want to check if a particular page gets redirected or not. However, whenever
Page in question: http://phwsinc.com/our-work/one-rincon-hill.asp In IE6-8, when you click the left-most thumbnail in the
I have a login page. Whenever the page loads, the cursor should blink in
I want to play an audio file whenever my page gets loaded onto the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.