package com.wsy;
import java.sql.*;
import java.util.*;
import java.text.*;
public class selectsql {
public static ResultSet rs;
public static StringTrans s;
public static connsqlserver connsqlserver=new connsqlserver();
/*
* 关于tb_usertable表的操作
*/
public static Collection getRet(){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_usertable";
rs=connsqlserver.executeQuery(sql);
while(rs.next()){
String names=rs.getString("name");
String passwords=rs.getString("password");
user user=new user();
user.setName(names);
user.setPassword(passwords);
ret.add(user);
}
}
catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public static int check(String name,String password){
int i=0;
String names="";
String passwords="";
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_usertable where name='"+name+"'and password='"+password+"'";
System.out.println(sql);
rs=connsqlserver.executeQuery(sql);
while(rs.next()){
names=rs.getString("name");
passwords=rs.getString("password");
if(names!=null){
i=1;
}
}
}
catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return i;
}
/*
* 关于tb_news表的操作
*/
public int Insert(String title,String author,String news){
int i=0;
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="insert into tb_news(title,author,content) values('"+title+"','"+author+"','"+news+"')";
i=connsqlserver.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return i;
}
public void Insert1(String title,String author,String news){
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="insert into tb_business(title,author,content) values('"+title+"','"+author+"','"+news+"')";
connsqlserver.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}
}
public Collection selectNewsAll(){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_news";
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
news news1=new news();
news1.setId(rs.getString("id"));
news1.setTitle(rs.getString("title"));
news1.setContent(rs.getString("content"));
news1.setAuthor(rs.getString("author"));
news1.setSubmittime(rs.getString("submittime"));
ret.add(news1);
}
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public Collection selectNews(String id){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_news where id='"+id+"'";
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
String ids=rs.getString("id");
String title=rs.getString("title");
String author=rs.getString("author");
String news=rs.getString("content");
news news1=new news();
news1.setId(ids);
news1.setTitle(title);
news1.setContent(news);
news1.setAuthor(author);
ret.add(news1);
}
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public Collection selectNews(){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select top 6 * from tb_news";
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
String title=rs.getString(2);
String author=rs.getString(3);
String news=rs.getString(4);
news news1=new news();
news1.setTitle(title);
news1.setContent(news);
news1.setAuthor(author);
ret.add(news1);
}
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public Collection selectNewsforqyxw(){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select top 15 * from tb_news";
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
String title=rs.getString(2);
String author=rs.getString(3);
String news=rs.getString(4);
news news1=new news();
news1.setTitle(title);
news1.setContent(news);
news1.setAuthor(author);
ret.add(news1);
}
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public int updateNews(String title,String content,String author,String id){
int i=0;
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="UPDATE tb_news SET title = '"+title+"', content = '"+content+"', author = '"+author+"' WHERE (id = '"+id+"')";
i=connsqlserver.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return i;
}
public int delNews(String id){
int i=0;
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="delete from tb_news where id='"+id+"'";
i=connsqlserver.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return i;
}
/*
* 关于tb_business表的操作
*/
public Collection selectBusinessAll(){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_business";
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
product product=new product();
product.setId(rs.getString("id"));
product.setImg(rs.getString("img"));
product.setMsg(rs.getString("ms"));
product.setName(rs.getString("name"));
product.setSubmittime(rs.getString("submittime"));
product.setCategory(rs.getString("category"));
ret.add(product);
}
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public ResultSet selectbusiness(){
ResultSet rs=null;
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_business";
rs=connsqlserver.executeQuery(sql);
rs.last();
}catch(Exception e){
e.printStackTrace();
}
//connsqlserver.close();
return rs;
}
public Collection selectBusinessForId(String id){
Collection ret=new ArrayList();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select * from tb_business where id='"+id+"'";
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
product product=new product();
product.setId(rs.getString("id"));
product.setImg(rs.getString("img"));
product.setMsg(rs.getString("ms"));
product.setName(rs.getString("name"));
product.setSubmittime(rs.getString("submittime"));
product.setCategory(rs.getString("category"));
ret.add(product);
}
}catch(Exception e){
e.printStackTrace();
}
connsqlserver.close();
return ret;
}
public Collection selectBusinessFy(int page){
Collection ret=new ArrayList();
DownTable down=new DownTable();
try{
connsqlserver connsqlserver=new connsqlserver();
String sql="select top 10 * from tb_business where id not in(select top "+down.getPageSize()*page+" id from tb_business order by id)order by id";
//String sql="select * from (select top 20 * from (select top "+10*page+" * from tb_business order by id ASC)as aSysTable order by id desc) as bsystable order by id ASC";
//System.out.println(sql);
ResultSet rs=connsqlserver.executeQuery(sql);
while(rs.next()){
product product=new product();
product.setId(rs.getString("id"));
product.setImg(rs.getString("img"));
product.setMsg(rs.getString("ms"));
product.setName(rs.getS
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
开发企业门户网站的最终目的是为企业提供一个简单、易用、开放、可扩展的企业信息门户平台。通过需求分析以及与客户的沟通,现制定网站实现目标如下:网站使用人性化设计,界面友好、安全、实用,网站操作便捷并具有高度信息延续性、可扩展性,提供建立在关系型数据库系统上的数字信息组织、管理、查询等功能,对用户输入的数据进行严格的数据检索,尽可能地排除人为错误, 最大限度地实现网站易维护性和易操作性。(SQL数据库)
资源详情
资源评论
资源推荐
收起资源包目录
EnterpriseWebsite(Java).rar_ digital RETRIEVAL_企业网站设计_企业门户网站_网站 (150个子文件)
selectsql.class 11KB
connsqlserver.class 2KB
ModifyCode.class 2KB
DownTable.class 1KB
product.class 1KB
StringTrans.class 1KB
news.class 1KB
category.class 915B
user.class 727B
.classpath 1KB
style.css 971B
Thumbs.db 199KB
Thumbs.db 114KB
Thumbs.db 27KB
Thumbs.db 22KB
Thumbs.db 6KB
Thumbs.db 6KB
db_net 1.08MB
readme.doc 390KB
5.gif 57KB
4.gif 56KB
ht03.gif 52KB
2.gif 49KB
5.gif 49KB
4.gif 49KB
7.gif 46KB
3.gif 30KB
4.gif 27KB
1.gif 27KB
3.gif 25KB
4.gif 24KB
ht05.gif 23KB
ht05new2.gif 23KB
32.gif 23KB
31.gif 22KB
33.gif 22KB
30.gif 21KB
ht06.gif 21KB
2.gif 13KB
ht02.gif 13KB
10.gif 11KB
5.gif 11KB
8.gif 10KB
ht01.gif 10KB
5.gif 10KB
8.gif 10KB
14.gif 10KB
7.gif 10KB
9.gif 10KB
4.gif 10KB
6.gif 10KB
6.gif 10KB
6.gif 8KB
3.gif 7KB
8.gif 7KB
7.gif 6KB
1.gif 6KB
11.gif 6KB
ht04.gif 6KB
ht043.gif 6KB
ht045.gif 6KB
ht042.gif 6KB
ht044.gif 6KB
ht041.gif 5KB
5.gif 2KB
2.gif 2KB
1.gif 2KB
12.gif 2KB
3.gif 1KB
1.gif 1KB
16.gif 946B
15.gif 857B
7.gif 645B
8.gif 635B
2.gif 519B
8.gif 517B
3.gif 517B
2.gif 517B
13.gif 484B
9.gif 458B
6.gif 456B
1.gif 456B
11.gif 456B
9.gif 403B
10.gif 264B
17.gif 231B
6.gif 225B
12.gif 223B
7.gif 157B
分隔符.gif 43B
分隔符.gif 43B
分隔符.gif 43B
分隔符.gif 43B
gswh.html 3KB
jszc.html 3KB
connsqlserver.java 1KB
ModifyCode.java 1KB
StringTrans.java 948B
product.java 887B
news.java 842B
共 150 条
- 1
- 2
邓凌佳
- 粉丝: 76
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Opencv+ROS自编相机驱动
- python绘制爱心表白专用
- 基于Jupyter实现的深圳市道路交通事故数据分析+源码(毕业设计&课程设计&项目开发)
- 车辆车牌检测源码和报告,使用python编写,下载即可运行,可做毕业设计
- ptgame-master1.zip
- GSDML-V2.3-wenglor-wenglor ident-20161007-112500.xml
- stm32心率检测keil5工程
- GSDML-V2.2-Murrelektronik-IMPACT67-20120315.xml
- GSDML-V2.31-Murrelektronik-MVK-MPNIO-F-20150903.xml
- 通过C#上位机与库卡(KUKA)机器人进行TCP通讯,实现实时位置返回及运动控制
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0