InsertParameter in iDictionary but Insert doesn't include all values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Roget
    New Member
    • Sep 2007
    • 2

    #1

    InsertParameter in iDictionary but Insert doesn't include all values

    Using a DetailsView and SQLDataSource controls I am passing three values through an InsertCommand into a SQL Server database.

    <asp:SqlDataSou rce ID="AP_ListData " runat="server" ConnectionStrin g="<%$ ConnectionStrin gs:SCMDConn %>"
    InsertCommand = "INSERT INTO tblPartMaster(A P_ID, PartName, PartNumber)VALU ES(@APID, @PartName, @PartNumber)"
    >
    <InsertParamete rs>
    <asp:Paramete r Name="APID" Type="String" />
    <asp:Paramete r Name="PartName" Type="String" />
    <asp:Paramete r Name="PartNumbe r" Type="String" />
    </InsertParameter s>

    I can check the Dictionary entried of what is being passed in the DetailsView1_It emInserted method.

    Here's what it returns:
    There are 3 Key/Value pairs:
    Key=PartNumber, Value=Part123
    Key=PartName, Value=Test Part Name
    Key=AP_ID, Value=7

    I would assume that if it is found in the Dictionary in the ItemInserted event, it would have found its way as a valid parameter.

    A new record is in fact Inserted into the database. The PartNumber is passed, the PartName is passed but the AP_ID value (7) doesn't make it.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Is the AP_ID a settable column in the database?

    Comment

    • Roget
      New Member
      • Sep 2007
      • 2

      #3
      Yes it is. Just to check I ran the InsertCommand in SQL Query Analyzer and it inserted the record.

      Comment

      Working...