啊。。这个问题解决了。只需要把lx2 = "喜剧片"改成lx2 like ’喜剧片‘就可以了
在问一个。我在ASPX.CS中设置了cmd.Parameters.Add("@lx",TextBox1.Text.tostring());
在SQL的存储过程中调用这个@lx,象这样怎么不行啊。。该任何写
CREATE procedure ypph
(@pagesize int,
@pageindex int,
@docount bit,
@lx nvarchar(50))
as
set nocount on
if(@docount=1)
select count(id) from title where lx2 like  @lx
该如何设置“lx2 like @lx”还是在“@lx nvarchar(50))”这里错了,或是“cmd.Parameters.Add("@lx",TextBox1.Text.tostring());这里错了?

解决方案 »

  1.   

    解决了。。习惯了有问题就想到大家啊依赖性开始有点强了哎
    在问一个问题。在datalist中默认的是显示几次<ItemTemplate>,我用默认的在<ItemTemplate>的表格显示了无个,任何来修改这个值?
    <asp:datalist id="title" runat="server" Width="545px" Height="100px" RepeatColumns="1" RepeatDirection="Horizontal" ShowHeader="False" ShowFooter="False">
    <ItemStyle Width="100%"></ItemStyle>
    <ItemTemplate>
    <table border="1" width="100%" height="128">
    <tr>
    <td width="19%" rowspan="4" height="122">
    <img src="" align="left" hspace="10" />
    </td>
    <td width="38%" height="16">片名:<%#DataBinder.Eval(Container.DataItem,"title")%></td>
    <td width="43%" height="16">演员:<%#DataBinder.Eval(Container.DataItem,"yy")%></td>
    </tr>
    <tr>
    <td width="38%" height="16">语种:<%#DataBinder.Eval(Container.DataItem,"dy")%></td>
    <td width="43%" height="16">地区:<%#DataBinder.Eval(Container.DataItem,"title")%></td>
    </tr>
    <tr>
    <td width="38%" height="16">点击次数:</td>
    <td width="43%" height="16">推荐级别:</td>
    </tr>
    <tr>
    <td width="81%" colspan="2" height="56">内容介绍:
    </td>
    </tr>
    </table>
    </ItemTemplate>
    </asp:datalist>
      

  2.   

    存储过程中可不可以有参数来替代要判断的字段。这样的写法对不对?
    where @lx like  @lx1