package com.ddChat.dao;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.ddChat.model.UserInfoModel;


public class UserInfoDao
{
public UserInfoDao()
{

}
public  int userInfoAdd(Connection con,UserInfoModel userInfo) throws Exception
    {
//INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
String sql  ="insert into user_info (user_id,nick_name, password, sex, birth_day, at_city) values (null,?,?,?,?,?)";
        PreparedStatement ps = con.prepareStatement(sql);
        ps.setString(1, userInfo.getNick_name());
        ps.setString(2, userInfo.getPassword());
        ps.setString(3, userInfo.getSex());
        ps.setString(4, userInfo.getBirth_day());
        ps.setString(5, userInfo.getAt_city());
        return ps.executeUpdate();
    }
public ResultSet userInfoList(Connection con) throws Exception
    {
        String sql = "select * from tb_bookType";
        PreparedStatement ps = con.prepareStatement(sql);
        return ps.executeQuery();        
    }


}

01-02 22:11