选择任意多个查询条件点击查询按钮根据查询条件显示查询内容
我在页面上有几个可以选择填入的查询条件然后根据查询条件查询出所需要的内容,
如何判断text值是空时??这是我写得存储过程
SELECT [cd_tag]
      ,[cd_schema]
      ,[cd_cnam]
      ,[cd_znam]
      ,[cd_memo]
      ,[cd_state]
      ,[cd_edate]
      ,[cd_tdate]
      ,[cd_tcnam]
      ,[cd_cdate]
      ,[cd_ccnam]
  FROM [ITS].[dbo].[cndetail]set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER Proc  [dbo].[pstate14]
     @cd_schema [varchar](20),
     @cd_cnam [varchar](50),
     @cd_znam [varchar](50),
     @cd_state  [bit],
     @cd_edate   [datetime],
     @cd_tdate  [datetime],
     @cd_tcnam  [nchar](10),
     @cd_cdate  [datetime],
     @cd_ccnam  [nchar](10),
     @c_cnam  [nvarchar](50),
     @c_btype  [varchar](24),
     @c_stype  [varchar](24),
     @c_dept [nvarchar](50)
    
AS
DECLARE @sql [nvarchar](200)
set @sql = 'select [cd_schema],[cd_cnam] ,[cd_znam],[cd_state] ,[cd_edate],[cd_tdate] ,[cd_tcnam] ,[cd_cdate] ,[cd_ccnam]
      ,[c_cnam] ,[c_btype] ,[c_stype] ,[c_nschema]  ,[c_dept] from [cndetail],[cnschema] where  1=1 and c_tag=cd_tag'
if ( @cd_schema is not null and len(@cd_schema)=0)  
     set @sql = @sql+' and  cd_schema = '+  @cd_schema + '  ' 
if (@cd_cnam  is not null and len(@cd_cnam)=0) 
    set @sql = @sql+ ' and cd_cnam = ' + @cd_cnam + ' '
if (@cd_znam  is not null and len(@cd_znam)=0) 
    set @sql = @sql+ ' and cd_znam = ' + @cd_znam + ' ' 
if (@cd_edate  is not null and len(@cd_edate)=0) 
    set @sql = @sql+ ' and cd_edate = ' + @cd_edate + ' '
if (@cd_tdate is not null and len(@cd_tdate)=0) 
    set @sql = @sql+ ' and cd_tdate = ' + @cd_tdate + ' '
if (@cd_tcnam is not null and len(@cd_tcnam)=0) 
    set @sql = @sql+ ' and cd_tcnam = ' + @cd_tcnam + ' '
if (@cd_cdate  is not null and len(@cd_cdate)=0) 
    set @sql = @sql+ ' and cd_cdate = ' + @cd_cdate + ' '
if (@cd_ccnam is not null and len(@cd_ccnam)=0) 
    set @sql = @sql+ ' and cd_ccnam = ' + @cd_ccnam + ' '
if (@c_cnam  is not null and len(@c_cnam)=0) 
    set @sql = @sql+ ' and c_cnam = ' + @c_cnam + ' '
if (@c_btype  is not null and len(@cd_znam)=0) 
    set @sql = @sql+ ' and c_btype = ' + @c_btype + ' '
if (@c_stype  is not null and len(@c_stype)=0) 
    set @sql = @sql+ ' and c_stype = ' + @c_stype + ' '
if (@c_dept  is not null and len(@c_dept)=0) 
    set @sql = @sql+ ' and c_dept = ' + @c_dept + ' '
exec(@sql)后台(vb)
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click    
        Me.SqlDataSource3.SelectParameters("cd_schema").DefaultValue = Me.TextBox1.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_cnam").DefaultValue = Me.TextBox5.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_znam").DefaultValue = Me.TextBox6.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_edate").DefaultValue = Me.TextBox8.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_cdate").DefaultValue = Me.TextBox4.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_tcnam").DefaultValue = Me.tetxcd_znam.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_tdate").DefaultValue = Me.TextBox2.Text.ToString
        Me.SqlDataSource3.SelectParameters("cd_ccnam").DefaultValue = Me.TextBox3.Text.ToString
        Me.GridView1.DataBind()    End Sub
前台
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" DataSourceID="SqlDataSource3"   Font-Size="9pt" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None"   PageSize="5">
    
        <Columns>
            <asp:BoundField DataField="cd_schema" HeaderText="编码" SortExpression="cd_schema" />
            <asp:BoundField DataField="cd_cnam" HeaderText="中文名字" SortExpression="cd_cnam" />
            <asp:BoundField DataField="cd_znam" HeaderText="英文名字" SortExpression="cd_znam" />
            <asp:BoundField DataField="cd_memo" HeaderText="备注" SortExpression="cd_memo" />
            <asp:BoundField DataField="cd_state" HeaderText="状态" SortExpression="cd_state" />
            <asp:BoundField DataField="cd_edate" HeaderText="有效日期" SortExpression="cd_edate" />
            <asp:BoundField DataField="cd_tdate" HeaderText="录入日期" SortExpression="cd_tdate" />
            <asp:BoundField DataField="cd_tcnam" HeaderText="录入人员" SortExpression="cd_tcnam" />
            <asp:BoundField DataField="cd_cdate" HeaderText="异动日期" SortExpression="cd_cdate" />
            <asp:BoundField DataField="cd_ccnam" HeaderText="异动人员" SortExpression="cd_ccnam" />
            <asp:BoundField DataField="c_cnam" HeaderText="区域" SortExpression="c_cnam" />
            <asp:BoundField DataField="c_dept" HeaderText="部门" SortExpression="c_dept" />
              <asp:TemplateField HeaderText="编码原则" SortExpression="c_nschema">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("c_nschema") %>' TextMode="MultiLine"
                        Width="220px"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" ReadOnly="True" Text='<%# Bind("c_nschema") %>'
                        TextMode="MultiLine" Width="180px"></asp:TextBox>
                </ItemTemplate>
              </asp:TemplateField>
        </Columns>
    <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
        <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
    
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:connstr040ITS %>"
        SelectCommand="pstate14" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter    Name="cd_schema" type="String" />
            <asp:Parameter    Name="cd_cnam"  type="String" />
            <asp:Parameter    Name="cd_znam"    type="String"/>
            <asp:Parameter    Name="cd_state"  type="Boolean"/>
            <asp:Parameter    Name="cd_edate" type="String"/>
            <asp:Parameter    Name="cd_tdate" type="String" />
            <asp:Parameter    Name="cd_tcnam"  type="String"/>
            <asp:Parameter    Name="cd_cdate"  type="String" />
            <asp:Parameter    Name="cd_ccnam"  type="String"/>
            <asp:ControlParameter ControlID="dpdnlstAreaList" Name="c_cnam" PropertyName="SelectedValue" ConvertEmptyStringToNull="False"/>
            <asp:ControlParameter ControlID="DropDownList2"  PropertyName="SelectedValue"  Name="c_btype"  ConvertEmptyStringToNull="False"/>
            <asp:ControlParameter ControlID="DropDownListctype"  PropertyName="SelectedValue"  Name="c_stype" ConvertEmptyStringToNull="False" />
            <asp:ControlParameter ControlID="dpdnlstDeptList"  PropertyName="SelectedValue"  Name="c_dept" ConvertEmptyStringToNull="False" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
</asp:Content>
高人们帮我看看啊
!!
老是取不到数据