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
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
收集的一些比较实用的java的小项目4 (445个子文件)
selectsql.class 11KB
Dao.class 10KB
CartCheckoutController.class 6KB
VMemberId.class 5KB
TbOrder.class 4KB
VGoods.class 4KB
TbMember.class 4KB
CartController.class 4KB
TbGoods.class 4KB
SearchController.class 4KB
GoodsModifyController.class 3KB
LoginController.class 3KB
RegisterController.class 3KB
SuperTypeController.class 3KB
LoginController.class 3KB
ModifyMemberForm.class 3KB
GoodsDelController.class 3KB
ProductManagerController.class 3KB
SubTypeAddController.class 3KB
VOrderDetailId.class 3KB
ModifyMemberValidate.class 2KB
MemberTilesController.class 2KB
MemberManagerController.class 2KB
GoodsAddController.class 2KB
PlacardAddController.class 2KB
NewGoodsController.class 2KB
VTypeId.class 2KB
SuperTypeAddController.class 2KB
GoodsDetailsController.class 2KB
OrderManagerController.class 2KB
SubTypeController.class 2KB
PlacardManageController.class 2KB
connsqlserver.class 2KB
TbOrderDetail.class 2KB
ModifyMemberController.class 2KB
ModifyMemberTilesController.class 2KB
CartCheckoutForm.class 2KB
CartCheckoutTilesController.class 2KB
PlacardDetailsController.class 2KB
TypeController.class 2KB
OrderDetailsController.class 2KB
ModifyCode.class 2KB
OrderController.class 2KB
GridLayoutDemo.class 2KB
TbBbs.class 2KB
TypeListTilesController.class 2KB
GoodsAddTilesController.class 1KB
DownTable.class 1KB
product.class 1KB
SubTypeAddTilesController.class 1KB
SearchTileController.class 1KB
sellSortTilesController.class 1KB
SubTypeTilesController.class 1KB
StringTrans.class 1KB
placardTilesController.class 1KB
TbSubType.class 1KB
news.class 1KB
TbRebate.class 1KB
GoodsElement.class 1KB
TbManager.class 1KB
TbSuperType.class 1KB
GridLayoutDemo$1.class 1KB
category.class 915B
SearchForm.class 781B
SubTypeAddForm.class 762B
UserLoginForm.class 746B
LoginForm.class 738B
user.class 727B
CommandForm.class 722B
VOrderDetail.class 685B
VMember.class 655B
VType.class 643B
ProductCommand.class 589B
SuperTypeAddForm.class 577B
SuperTypeForm.class 562B
OrderManageTilesController.class 529B
.classpath 1KB
.classpath 780B
style.css 2KB
style.css 971B
css.css 47B
db_net 1.08MB
readme.doc 898KB
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
共 445 条
- 1
- 2
- 3
- 4
- 5
资源评论
- alecli0002016-11-15挺好的,谢谢分享
this_is_java
- 粉丝: 13
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 已过基于Hadoop+Spark招聘推荐可视化系统 大数据项目 毕业设计(源码下载)
- python爬虫开发题答案及题目-100(1).zip
- Python 小游戏 (贪吃蛇、五子棋、扫雷、俄罗斯方块)-3 (2).zip
- c语言实现的数独小游戏.zip
- 高德地图中国行政区划省、市、县经纬度
- March 2024 Expiration Of The OAM Out Of The Box Certificates
- 二叉搜索树迭代器(java代码).docx
- 解决keil MDK 5.38版本 在Debug配置使用STlink调试时软件闪退的问题
- py小项目:用户登录和注册系统开发欢迎图片
- TCCEE-x64-v6.2.3(9.51)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功