M
Mike
I posted this is m.p.d.f.aspnet last night, but got no useful response. I
have also googled this group (and a lot of others), and have not found a
satisfactory explanation.
I have a stored proc with one parameter:
CREATE PROCEDURE [dbo].[qDeleteAgencyDetails]
@AgencyID int
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM Agency WHERE AgencyID = @AgencyID
END
I use a dropdownlist to select an option which is displayed in a Formview,
which has an associated SqlDataSource with SELECT/INSERT/UPDATE and DELETE
commands specified. The control parameters for the commands are identical:
<UpdateParameters>
...
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
<DeleteParameters>
The SELECT, INSERT and UPDATE work as expected, but the DELETE throws the
exception (in the subject). I've got no code-behind interfering. The whole
thing is wired up declaratively at the moment.
I used the wizard to configure the DataSource, and selected the appropriate
procs. I manually applied the UPDATE and DELETE ControlParameters, copying
and pasting the value given by the wizard for the SELECT ControlParameter.
(Why DOES the wizard duplicate the controls in the parameter drop-down
list?!?) The DELETE stored proc runs fine through SSMS. Other pages that
follow exactly the same format as this one (although they deal with
different, but similarly structured tables) work fine in all respects.
I have changed the Delete CommandType to Text, and gave the CommandText
value as "DELETE FROM Agency WHERE AgencyID = @AgencyID". The page works
fine now, so while I guess I have got round my problem, I still don't know
what the problem was.
Is there some bug in the way that VS2005 or VWD configures SqlDatasources?
It obviously aint right, otherwise it wouldn't list controls twice in the
parameter configuration dop-down.
Mike
have also googled this group (and a lot of others), and have not found a
satisfactory explanation.
I have a stored proc with one parameter:
CREATE PROCEDURE [dbo].[qDeleteAgencyDetails]
@AgencyID int
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM Agency WHERE AgencyID = @AgencyID
END
I use a dropdownlist to select an option which is displayed in a Formview,
which has an associated SqlDataSource with SELECT/INSERT/UPDATE and DELETE
commands specified. The control parameters for the commands are identical:
<UpdateParameters>
...
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
<DeleteParameters>
The SELECT, INSERT and UPDATE work as expected, but the DELETE throws the
exception (in the subject). I've got no code-behind interfering. The whole
thing is wired up declaratively at the moment.
I used the wizard to configure the DataSource, and selected the appropriate
procs. I manually applied the UPDATE and DELETE ControlParameters, copying
and pasting the value given by the wizard for the SELECT ControlParameter.
(Why DOES the wizard duplicate the controls in the parameter drop-down
list?!?) The DELETE stored proc runs fine through SSMS. Other pages that
follow exactly the same format as this one (although they deal with
different, but similarly structured tables) work fine in all respects.
I have changed the Delete CommandType to Text, and gave the CommandText
value as "DELETE FROM Agency WHERE AgencyID = @AgencyID". The page works
fine now, so while I guess I have got round my problem, I still don't know
what the problem was.
Is there some bug in the way that VS2005 or VWD configures SqlDatasources?
It obviously aint right, otherwise it wouldn't list controls twice in the
parameter configuration dop-down.
Mike