D
Don Quijote de Nicaragua
Hello I have a sqldatasource to link it with a procedure
stored which will pass two parameters
1- @option to determine the query and @ IDNO for the code to
find, but when I finish with the wizard to configure the gridview
ALWAYS ALWAYS set the Gridview with me the first @option.
Any suggestions.
Don Quijote de Nicaragua
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:csProductoTerminado %>"
SelectCommand="paAAA" SelectCommandType="StoredProcedure">
<SelectParameters>
<asparameter DefaultValue="2" Name="Opcion"
Type="Int32" />
<asparameter DefaultValue="6" Name="IdNo"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
ALTER PROCEDURE [dbo].[paAAA]
@Opcion as int,
@IdNo as int = NULL
AS
BEGIN
--List 1
IF @Opcion=1
SELECT * FROM tblOrdenes WHERE (@IdNo IS NULL OR tblOrdenesCensa.IdNo
= @IdNo)
--List 2
ELSE IF @Opcion=2
SELECT dbo.tblO.IdNo FROM dbo.tblO WHERE (@IdNo IS NULL OR
dbo.tblO.IdNo = @IdNo)
END
stored which will pass two parameters
1- @option to determine the query and @ IDNO for the code to
find, but when I finish with the wizard to configure the gridview
ALWAYS ALWAYS set the Gridview with me the first @option.
Any suggestions.
Don Quijote de Nicaragua
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:csProductoTerminado %>"
SelectCommand="paAAA" SelectCommandType="StoredProcedure">
<SelectParameters>
<asparameter DefaultValue="2" Name="Opcion"
Type="Int32" />
<asparameter DefaultValue="6" Name="IdNo"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
ALTER PROCEDURE [dbo].[paAAA]
@Opcion as int,
@IdNo as int = NULL
AS
BEGIN
--List 1
IF @Opcion=1
SELECT * FROM tblOrdenes WHERE (@IdNo IS NULL OR tblOrdenesCensa.IdNo
= @IdNo)
--List 2
ELSE IF @Opcion=2
SELECT dbo.tblO.IdNo FROM dbo.tblO WHERE (@IdNo IS NULL OR
dbo.tblO.IdNo = @IdNo)
END