怎样对数据库查询,jsp语句,哪位兄弟能告知一下

解决方案 »

  1.   

    你说的是java连接数据库吧,查出对象传到jsp中显示出来。JDBC连接数据库的规范,
    package util;import java.sql.Connection;
    import java.sql.DriverManager;public class DBUtil {
    public static Connection getConnection() throws Exception{
    Connection conn = null;
    try {
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection(
    "jdbc:mysql://localhost:3306/test" +
    "?useUnicode=true&characterEncoding=utf8",
    "root","1234");
    } catch (Exception e) {
    e.printStackTrace();
    throw e;
    }
    return conn;
    }

    public static void close(Connection conn) throws Exception{
    if(conn !=null){
    try {
    conn.close();
    } catch (Exception e) {
    e.printStackTrace();
    throw e;
    }
    }
    }
    /**
     * @param args
     * @throws Exception 
     */
    public static void main(String[] args) throws Exception {
    System.out.println(getConnection());
    }}
      

  2.   

    不是,是按照条件查询的jsp语句
      

  3.   

    <%
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); String url="jdbc:oracle:thin:@localhost:1521:orcl"; 
    String user="scott"; String password="tiger"; Connection conn= DriverManager.getConnection(url,user,password); Statement stmt=conn.createStatement(); String sql="select * from Student where id < 1000"; ResultSet rs=stmt.executeQuery(sql); 
    %>这样么?
      

  4.   

    你是说 根据jsp 里面的值 查询数据库 这个在单jsp页面是无法实现的  或者 将值传到action 中处理 
      

  5.   

    include'conn.php';
    $name=$_GET['name'];
    $e_mail=$_GET['e_mail'];
    $tel=$_GET['phone'];
    $insert="insert into tbl_stu values(NULL,'$name','$e_mail','$tel')";
    ; $sql="select *from tbl_stu";
     $result=mysql_query($sql);
     $row=mysql_fetch_row($result);
      

  6.   

    直接在SQL WHERE子句里加啊 时间字段名>日期下限 and 时间字段名<日期上限
      

  7.   

    你说的是ajax吧,级联,不刷新整体页面,当你换了条件后,会改变下方列表数据吧。。
      

  8.   

    select * from tableName columnTime > MinTime and columnTime < MaxTime
      

  9.   

    sql语句不会还是在jsp中查询不会
    神马模式 mvc还是ssh
      

  10.   

    我没有用什么模式,就是简单地练习一下jsp