locked
Insert Issues RRS feed

  • Question

  • User1225210238 posted

    I created a new table called "Products" that I based on the "Announcements" table and am trying to insert information into it. When I fill out the information and hit the "Save" button I do not get any errors but no information is being saved into the table. Any ideas?

     

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"

    SelectCommand="SELECT id, name, title, description, features, specs, photo, albumid from Products where Products.id=@id"

    InsertCommand="INSERT INTO Products(name, title, description, features, specs, photo, albumid) VALUES (@name, @title, @description, @features, @specs, @photo, @albumid)"

    UpdateCommand="UPDATE Products SET name = @name, title = @title, description = @description, features = @features, specs = @specs, photo = @photo, albumid = @albumid WHERE (id = @id)"

    DeleteCommand="Delete from Products where id=@id" OldValuesParameterFormatString="{0}">

    <SelectParameters>

    <asp:QueryStringParameter Name="id" QueryStringField="ArticleID" />

    </SelectParameters>

    <UpdateParameters>

    <asp:Parameter Name="name" />

    <asp:Parameter Name="title" />

    <asp:Parameter Name="description" />

    <asp:Parameter Name="features" />

    <asp:Parameter Name="specs" />

    <asp:Parameter Name="photo" />

    <asp:Parameter Name="id" />

    <asp:Parameter Name="albumid" />

    </UpdateParameters>

    <InsertParameters>

    <asp:Parameter Name="name" />

    <asp:Parameter Name="title" />

    <asp:Parameter Name="description" />

    <asp:Parameter Name="features" />

    <asp:Parameter Name="specs" />

    <asp:Parameter Name="photo" />

    <asp:Parameter Name="id" />

    <asp:Parameter Name="albumid" />

    </InsertParameters>

    <DeleteParameters>

    <asp:QueryStringParameter Name="id" QueryStringField="ArticleID" />

    </DeleteParameters>

    </asp:SqlDataSource>

    <asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>" ID="AlbumList"

    runat="server" SelectCommand="AlbumList" SelectCommandType="StoredProcedure"

    OnSelecting="AlbumList_Selecting">

    <SelectParameters>

    <asp:Parameter Name="userid" />

    </SelectParameters>

    </asp:SqlDataSource>

    Wednesday, March 7, 2007 2:47 PM

All replies

  • User-2058016573 posted

    Did you ever figure this out?  I've got the same issue, plus the Edit function doesn't work.  New table, new view and edit forms, but the edit and insert isn't working.  Like you, I get no errors, just nothing gets updated or inserted.  The delete function works though.

    Kevin

    Wednesday, April 11, 2007 11:30 AM
  • User1225210238 posted

    Kevin,

     I am going to test it on the LIVE server and see if it works or not. I never got it to work on my local machine though. I think it might be the permissions for the tables but I'm not sure. I will let you know if I come up with anything. Let me know if you find anything as well.

    Wednesday, April 11, 2007 1:53 PM
  • User1225210238 posted

    Kevin,

    My error was in my Insert Command. I rewrote it and everything worked just fine. I thought that my problem was there but couldn't find it before. Let me know if you need any help.

    Wednesday, April 11, 2007 2:35 PM
  • User-2058016573 posted

    It looks like you were doing basically the same thing I tried which was use the code from an existing page.  I posted a message last night (http://forums.asp.net/thread/1660257.aspx), if you see anything obvious (or need to see any other code to help track down the problem), please let me know.  I think it is something similar to what you have found, since I can't insert or update but can delete, but I'll be darned if I can find it.

    Thanks!
    Kevin

    Wednesday, April 11, 2007 2:48 PM