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

📄 librarydao.java

📁 这是一个基于图书馆系统 主要是用struts hibernate oracle做的
💻 JAVA
字号:
package com.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.actionForm.LibraryForm;
import com.core.ConnDB;

public class LibraryDAO {
	com.core.ConnDB conn = null;

	public LibraryDAO() {
		conn = new ConnDB();
	}

	public LibraryForm query() {
		String sql = "select * from tb_library where id=1";
		ResultSet rs = conn.executeQuery(sql);
		LibraryForm libraryForm1 = null;
		try {
			while (rs.next()) {
				libraryForm1 = new LibraryForm();
				libraryForm1.setId(Integer.valueOf(rs.getString(1)));
				libraryForm1.setLibraryname(rs.getString(2));
				libraryForm1.setCurator(rs.getString(3));
				libraryForm1.setTel(rs.getString(4));
				libraryForm1.setAddress(rs.getString(5));
				libraryForm1.setEmail(rs.getString(6));
				libraryForm1.setUrl(rs.getString(7));
				libraryForm1.setCreateDate(rs.getString(8));
				libraryForm1.setIntroduce(rs.getString(9));
			}
		} catch (SQLException e) {
		}
		conn.close();
		return libraryForm1;

	}
	public int update(LibraryForm libraryForm) {
		String sql = "UPDATE tb_library SET libraryname='"
				+ libraryForm.getLibraryname() + "',curator='"
				+ libraryForm.getCurator() + "',tel='" + libraryForm.getTel()
				+ "',address='" + libraryForm.getAddress() + "',email='"
				+ libraryForm.getEmail() + "',url='" + libraryForm.getUrl()
				+ "',createDate='" + libraryForm.getCreateDate()
				+ "',introduce='" + libraryForm.getIntroduce() + "' where id=1";
		int ret = conn.executeUpdate(sql);
		System.out.println("修改图书馆信息时的SQL:" + sql);
		conn.close();
		return ret;
	}

}

⌨️ 快捷键说明

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