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

📄 typetable.java

📁 这是基于jsp的相册管理系统。数据库是mysql
💻 JAVA
字号:
package huitong.util.db;

import java.util.*;
import java.sql.*;
import huitong.javabean.*;
import huitong.util.db.*;
public class TypeTable 
{
    public void addType(int albumTypeId,String albumName)
    {
    	if (albumName == null)
    	{
    		return;
    	}
    	String insertSQL = "insert into album_type(albumTypeId,albumName)" +
    			"values(" +albumTypeId+",'"+albumName+"'"+")";
    	System.out.println("in TypeTable addType() " + insertSQL);
    	new Connecter().insert(insertSQL);    	
    }
    
    public Iterator<AlbumType> getAlbumTypes()
    {
    	String querySQL = "select * from album_type";
    	System.out.println(" in TypeTable getAlbumType() " + querySQL);
    	ResultSet result = new Connecter().getResultSet(querySQL);
    	if (result == null )
    	{
    		return null;
    	}
    	try
    	{
    		HashSet set = new HashSet();
    		while (result.next())
        	{
        		set.add(AlbumType.getAlbumType(result));
        	}
    		return set.iterator();
    	}
    	catch (SQLException e)
    	{
    		e.printStackTrace();
    	}
    	
    	return null;
    }
    public static void main(String[] agrs)
    {
    	Iterator<AlbumType>  iter = new TypeTable().getAlbumTypes();
    	if (iter != null)
    	{
    		while (iter.hasNext())
    		{
    			System.out.println(iter.next().getAlbumTypeId());
    		}
    	}
    	
    }
}

⌨️ 快捷键说明

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