⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 701e6134163c001d111782b9be622526

📁 自己做的一个火车票售票网站是课程设计 用的是servlet+jsp 数据库是ms
💻
字号:
package com.daoImpl;

import com.dao.ChezhanDAO;
import com.vo.ChezhanVO;
import com.jdbc.*;
import java.sql.*;

import javax.servlet.http.HttpServletResponse;

public class ChezhanDAOImpl implements ChezhanDAO {

	public ChezhanVO cheZhanNumber(String chezhanName) {
		ChezhanVO vo = null;
		DataBaseConnection dbc = new DataBaseConnection();
		PreparedStatement psmt = null;
		ResultSet rs = null;
		String sql = "select * from chezhan where czname= ?";
		try {

			psmt = dbc.getConnection().prepareStatement(sql);
			psmt.setString(1, chezhanName);
			rs = psmt.executeQuery();
			if (rs.next()) {
				vo = new ChezhanVO();
				vo.setChezhanNumber(rs.getInt(1));
				vo.setChezhannName(rs.getString(2));
				
			}
			else{
				HttpServletResponse response=new HttpServletResponse();
				response.sendRedirect("error.jsp");
			}
		} catch (Exception e) {
			
		}

		return vo;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -