My UPDATE command fails to change any date in the table while very similar SELECT and DELETE commands work. When I change the UpdateParameters to invalid choices, the code behind command throws an error, buy when the parameters are correct, nothing hapens.
Code behind to activate DELETE (which works)
protected void Button2_Click(object sender, EventArgs e)
{
this.AccessDataSource6.Delete();
}
Code behind to activate UPDATE (which does seem to have any effect on the data)
protected void Button1_Click(object sender, EventArgs e)
{
this.AccessDataSource6.Update();
}
The AccessDatasource, its SQL commands and parameters
<asp:AccessDataSource ID="AccessDataSource6" runat="server" DataFile="~/App_Data/ASPNetDB.mdb"
SelectCommand="SELECT [PracticeDate],
[StartTime],
[EndTime],
[Division],
[TeamStr],
[FieldName]
FROM [vw_fbScheduleFull]
WHERE (([LocationID] = ?)
AND ([DayName] = ?)
AND ([PracticeDate] >= ?)
AND ([PracticeDate] <= ?)
AND ([StartTime] = ?))
ORDER BY [PracticeDate], [FieldName]"
UpdateCommand="UPDATE fbPracticeSlot
SET StartTime = ?, EndTime = ?
WHERE ID IN (
SELECT [PracticeSlotID]
FROM [vw_fbScheduleFull]
WHERE (([LocationID] = ?)
AND ([DayName] = ?)
AND ([PracticeDate] >= ?)
AND ([PracticeDate] <= ?)
AND ([StartTime] = ?))
)"
DeleteCommand="DELETE FROM fbPracticeSlot
WHERE ID IN (
SELECT [PracticeSlotID]
FROM [vw_fbScheduleFull]
WHERE (([LocationID] = ?)
AND ([DayName] = ?)
AND ([PracticeDate] >= ?)
AND ([PracticeDate] <= ?)
AND ([StartTime] = ?))
)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownListLocation" Name="LocationID" PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownListDOW" Name="DayName" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownListStartDate" Name="PracticeDate" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListEndDate" Name="PracticeDate2" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListStartTime" Name="StartTime" PropertyName="SelectedValue" Type="DateTime" />
</SelectParameters>
<UpdateParameters>
<asp:ControlParameter ControlID="DropDownListNewStart" Name="NewStartTime" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListNewEnd" Name="NewEndTime" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListLocation" Name="LocationID" PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownListDOW" Name="DayName" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownListStartDate" Name="PracticeDate" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListEndDate" Name="PracticeDate2" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListStartTime" Name="StartTime" PropertyName="SelectedValue" Type="DateTime" />
</UpdateParameters>
<DeleteParameters>
<asp:ControlParameter ControlID="DropDownListLocation" Name="LocationID" PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownListDOW" Name="DayName" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownListStartDate" Name="PracticeDate" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListEndDate" Name="PracticeDate2" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="DropDownListStartTime" Name="StartTime" PropertyName="SelectedValue" Type="DateTime" />
</DeleteParameters>
</asp:AccessDataSource>
Please help me understand why the update is not changing data.
It seems that I either need to write UpdateCommands with hard coded parameters for the values to change or write a DeleteCommand and InsertCommand for each update that I want to perform. Please help me find some way to avoid that sort of kludge.