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.
<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.
Comment