日期:2014-05-18 浏览次数:20431 次
<form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:GridView ID="GridView1" runat="server" AllowPaging="true" PageSize="5" DataSourceID="SqlDataSource1"> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=pdcx;User ID=pdcx;Password=pdcx;Unicode=True" ProviderName="System.Data.OracleClient" SelectCommand="SELECT * from US_USER" FilterExpression="us003='{0}'"> <FilterParameters> <asp:ControlParameter Name="code" ControlID="TextBox1" /> </FilterParameters> </asp:SqlDataSource> </div> </form>
<form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /> <asp:GridView ID="GridView1" runat="server" AllowPaging="true" PageSize="5" DataSourceID="SqlDataSource1"> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=pdcx;User ID=pdcx;Password=pdcx;Unicode=True" ProviderName="System.Data.OracleClient" SelectCommand="SELECT * from US_USER" FilterExpression="us003='{0}' or us004='{1}'"> <FilterParameters> <asp:ControlParameter Name="code" ControlID="TextBox1" /> <asp:ControlParameter Name="t" ControlID="TextBox2" /> </FilterParameters> </asp:SqlDataSource> </div> </form>
<asp:ControlParameter Name="code" ControlID="TextBox1" ConvertEmptyStringToNull="false" /> <asp:ControlParameter Name="t" ConvertEmptyStringToNull="false" ControlID="TextBox2" />
------解决方案--------------------
如果要实现楼主想要得的or逻辑,可能就需要用代码来控制了,例如:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionSt