ASP.NET SelectCommand(如果语句类型)

时间:2015-08-18 19:58:26

标签: asp.net

我有以下SelectCommand。我想做两件事。

首先是

    GroupId = @GroupId and LocationId = @LocationId 
然后那样做。

如果不存在,那么请执行以下操作:

    GroupId = @GroupId.

   SelectCommand= "SELECT * FROM [mkTp] WHERE ([GroupId] = @GroupId  and LocationId = @LocationId) OR  ([GroupId] = @GroupId)" 

这似乎不起作用。有没有办法做到这一点。这有点像if语句

请在下面找到更多信息:

     <SelectParameters>             
        <asp:ControlParameter ControlID="ddlM" Name="GroupId" PropertyName="SelectedValue"  Type="String"/>
      </SelectParameters>


    Note that  the ddlMu has the following info:

     Text = "Please Select",
      Value = "0"

0 个答案:

没有答案