查询代码是什么
--------------------
你说的是SQL语句?直接select + like关键词就行了啊

解决方案 »

  1.   

    我用连续的三个DropDownList下拉控件,里面可以选择查询条件,选择后,单击查询按钮,代码是什么,我连的是SQL2000数据库
      

  2.   

    select * from 医保医院信息 where 字段1 like 'drop1选中的值' and 字段2 like drop2选中的值
      

  3.   

    StringBuilder strBuilder = new StringBuilder();
    if (ddlOrderStatus.SelectedValue != "999")
            {
                strBuilder.Append(" and orderstate='" + ddlOrderStatus.SelectedValue + "'");
            }
            if (ddlTransType.SelectedValue != "0")
            {
                strBuilder.Append(" and transType='" + ddlTransType.SelectedValue + "'");
            }
            if (showtype.Trim() == "clearing")
            {
                strBuilder.Append(" and (payToOffer=1 or BackToOrder=1)");
            }  
    参考
      

  4.   

    动态拼了sql,相当一个万能查询.
      

  5.   

    建议:
    select * from 医保医院信息 where 字段1 = DropDownList1.SelectedItem.Text 
       and 字段2=DropDownList2.SelectedItem.Text 
       and 字段3=DropDownList3.SelectedItem.Text
      

  6.   

    string sql =  "SELECT * FROM t_news_purpose";
    if(DropDownList1.SelectedIndex != 0 )
    {
    sql += " WHERE 条件1 LIKE '%" + DropDownList1.SelectedValue +"%' ";
    }
    else if(DropDownList2.SelectedIndex != 0 )
    {
    sql += " WHERE 条件2 LIKE '%" + DropDownList2.SelectedValue +"%' ";
    }
    else if(DropDownList3.SelectedIndex != 0 )
    {
    sql += " WHERE 条件3 LIKE '%" + DropDownList3.SelectedValue +"%' ";
    }
     sql += " ORDER BY row_id DESC";
      

  7.   

    select 合肥医疗总表 form 医保医院信息 where '"+DropDownList.selectitem.item+"' and '"+DropDownList1.selectitem.item+"'and '"+DropDownList2.selectitem.item+"'
      

  8.   


    DataGrid1.DataSource = SelectFunction();
    DataGrid1.DataBind();public DataSet SelectFunction()
    {
       打开数库就不多说了...
       StringBuilder sqlBuilder = new StringBuilder(); 
         sqlBuilder.Append( "select * from 合肥医疗总表.医保医院信息 where 1=1")
       if ( DropDownList1.SelectValue != "0" ) sqlBuilder.Append(" And 字段='"+ DropDownList1.SelectValue +"'");
    if ( DropDownList2.SelectValue != "0" ) sqlBuilder.Append(" And 字段='"+ DropDownList2.SelectValue +"'");
    if ( DropDownList3.SelectValue != "0" ) sqlBuilder.Append(" And 字段='"+ DropDownList3.SelectValue +"'");sql = slqBuilder.ToString();
    赋值给Command
    Begin吧...
       }
      

  9.   

    如果只是要简单的实现的话用DataView的筛选是比较方便的
      

  10.   

    晕了,不是的,我说了是在.NET环境下,不是在SQL里,我只是和SQL2000相连的,有没有人会?我要完整的,最好有一个例子,把连接数据库的都写上.完整的.