Edit not updating db

Discussion in 'Databases' started by collegefootballsim.com, Feb 6, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. hey guys,

    i have a gridview set up and am trying to use the edit function. I have my edit button there, i can click it, i can change the data, i can then hit the update button. Everything works EXCEPT it doesn't actually update the data. I have a feeling this might be a somewhat common problem, I'm missing a line of code or something. Any help?

    P.S. If you need me to post code i'll be more than happy

    Thanks!
    Ryan
     
  2. With a little more info we can definitely help with this.
    What's the data source?
    Did you use the wizards?
    Which framework version?
     
  3. sql 2005 db
    visual web developer express
    didn't use a wizard
     
  4. When you used the Configure Data Source dialog did you create the update functions with the Advanced button?
    If you did and the Insert, Update, Deletestatements aren't working it would be good to recreate them.
    There can also be problems if the data on the SQL Server was altered, i.e. primary key missing.
     
  5. Reviving an old thread here. Went away from this problem for awhile to work on other parts of the project and now I'm back again and having the same problem. Everything seems to work fine except for the DB not actually updating. I'm using Visual Web Developer Express 2005 with SQL Server. I used the gridview, configure data source, selected columns, where and order clauses, and checked the update, select, delete box in advanced. Coming out of that I checked the enable editing box. I also have a template field with a drop down list that I manually inserted values into and then databinded the values to my 'lineup' column, in the hope that I can allow editing by the user of that column by the drop down list instead of just giving them a free-for-all.

    Anyway, here is my code, and if you'd like email me at [email protected] and i'll give an address to a page that will give you an idea of what it looks like (however the current code i'm debugging on my local computer)


     
  6. I'll help you through this, no prob.

    First, did you notice Player_Name is currently read only?
    Change that and see if the updates work.
    Salute,
    Mark
     
  7. You are correct. That worked.

    Now my question is this...I don't want the user to be able to change anything except the lineup drop down menu. How do I do that?
     
  8. Let's do this...
    (Keeping in mind I'm 46 with young children, 3, 6 and 9, driving me up a wall!)

    ZIP or RAR your code and the table it's using, just create the table with SQL if you know how.
    Send it to me, [email protected]
    I'll make the changes you want and send it back with notes.
    Honestly I find this a lot easier.
    Salute,
    Mark
     
  9. Hey wisemx,

    Just wanted to thanks and let you know that it's working likea charm. I have one other side question though. Why will it not let me edit gridviews that are selected from a view? It seems that no matter what I do, likecheck every field in both tables of the view, it will not give me the option to add in editing, deleting, etc. It grays out the box in the wizard. Is there a reason for this?
     
  10. Which server option do you have here?
    I'll post some tips once I know which version of ASP.NET you are targeting and the tools you're using.
    As you know it makes a big diff. [​IMG]
     
  11. I don't mean on the server here.

    When I go to the configure data source wizard in Visual Web Developer it asks:

    "How would you like to retrieve data from your database?"

    I click the box, "Specify columns from a table or view"

    Now, if I use a table, everything works fine. I check my tables, go to the Advanced Button and click the checkbox,'Generate Editing, Deleting', etc.

    However, if I use a view, no matter what I do when I go to the Advanced Button, the checkbox for Editing, etc. is grayed out, in other words it doesn't allow me the option of checking it. It says that all primary fields must be selected for this option to be enabled, but I seems I do this but to no avail.

    I'm stumped.
     
  12. Configuring the SQL data Source when you get to the "Specify columns from a table or view"...
    You can pick your View from the combobox but the columns are greyed out?
    If so, can you post that View?
     
  13. I've seen the VS products trip out on this but the main cause is always a missing primary key.
    You can not add those if the table does not have a primary key.
    As for editing a View, I haven't needed to add a View in there and don't even know if editing works with them.
    I'll look into this...
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page