1.求Java web增删改查 极简源码
2.求一个能实现屏幕水波纹效果的vb代码
求Java web增删改查 极简源码
//用户新增
public boolean addUser(Users user){
try {
conn = ConnDB.getConnection();
String sql = "insert into tb_users values(default,?,?,?,?,?,?)";
System.out.println(sql);
ps = conn.prepareStatement(sql);
ps.setInt(1, user.getDepID());
ps.setString(2, user.getUserName());
ps.setString(3, user.getUserPwd());
ps.setString(4, user.getUserCode());
ps.setString(5, user.getUserSex());
ps.setInt(6, user.getUserAge());
if(ps.executeUpdate()==1){
return true;
}
} catch (Exception e) {
e.printStackTrace();
} finally{ //关闭当前页打开的相关对象
ConnDB.close(conn, ps, null);
}
return false;
}
//用户删除
public boolean delUser(int id){
try {
conn = ConnDB.getConnection();
String sql = "delete from tb_users where id = ?";
System.out.println(sql);
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
if(ps.executeUpdate()==1){
return true;
}
} catch (Exception e) {
e.printStackTrace();
} finally{ //关闭当前页打开的相关对象
ConnDB.close(conn, ps, null);
}
return false;
}
//用户编辑
public boolean updateUser(Users user){
try {
conn = ConnDB.getConnection();
String sql = "update tb_users set depID=?,userName=?,userPwd=?,userCode=?,userSex=?,userAge=? where id=?";
System.out.println(user.getDepID()+ user.getUserName()+user.getUserPwd()+user.getUserCode()+user.getUserSex()+user.getUserAge()+user.getId());
ps = conn.prepareStatement(sql);
ps.setInt(1, user.getDepID());
ps.setString(2, user.getUserName());
ps.setString(3, user.getUserPwd());
ps.setString(4, user.getUserCode());
ps.setString(5, user.getUserSex());
ps.setInt(6, user.getUserAge());
ps.setInt(7, user.getId());
if(ps.executeUpdate()==1){
return true;
}
} catch (Exception e) {
e.printStackTrace();
} finally{ //关闭当前页打开的相关对象
ConnDB.close(conn, ps, null);
}
return false;
}
//根据id查询用户
public Users findAllUserById(int id){
Users u = null;
DepDao depd = null;
try {
conn = ConnDB.getConnection();
String sql = "select * from tb_users where id=?";
System.out.println(sql);
ps = conn.prepareStatement(sql);
ps.setInt(1, id);
rs = ps.executeQuery();
if(rs.next()){
depd = new DepDao();
Department dep = depd.findAllDepById(rs.getInt("depID"));
System.out.println(dep.getDepName());
u = new Users();
u.setId(rs.getInt("id"));
u.setDepID(rs.getInt("depID"));
u.setUserName(rs.getString("userName"));
u.setUserPwd(rs.getString("userPwd"));
u.setUserCode(rs.getString("userCode"));
u.setUserSex(rs.getString("userSex"));
u.setUserAge(rs.getInt("userAge"));
u.setDep(dep);
}
} catch (Exception e) {
e.printStackTrace();
} finally{ //关闭当前页打开的相关对象
ConnDB.close(conn, ps, rs);
}
return u;
}
这是我在dao层写的代码,都调用了ConnDB这个类,助创源码安装这个类完成了驱动的聊天交友平台源码注册,及连接数据库的html赛马游戏源码功能,代码如下:
package com.asjy.util;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class ConnDB {
private static String url = "jdbc:mysql://localhost:/news";
private static String user = "root";
private static String pass = "root";
//1.加载驱动
static{
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("驱动加载失败");
}
}
//2.建立数据库连接对象
public static Connection getConnection() throws Exception{
return DriverManager.getConnection(url,java考评系统源码user,pass);
}
//3.关闭数据库
public static void close(Connection conn,Statement ps,ResultSet rs){
try {
if(rs!=null){
rs.close();
rs = null;
}
if(ps!=null){
ps.close();
ps = null;
}
if(conn!=null){
conn.close();
conn = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
求一个能实现屏幕水波纹效果的vb代码
'补模块3文件。一个放不下。网页登录系统源码
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
' 渲染子程序,将新的帧数据渲染到 lpDIBitsRender 中
' 算法:
' posx = Wave1(x-1,y)-Wave1(x+1,y)+x
' posy = Wave1(x,y-1)-Wave1(x,y+1)+y
' SourceBmp(x,y) = DestBmp(posx,posy)
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Public Sub WaveRender(lpWaveObject As WAVE_OBJECT)
Dim dwPosX As Long, dwPosY As Long, dwPtrSource As Long, dwPtrDest As Long, dwFlag As Long
Dim lpWave1 As Long, LineIdx As Long, LinePtr As Long
Dim lpDIBitsSource As Long, lpDIBitsRender As Long
Dim I As Long, J As Long
dwFlag = 0
With lpWaveObject
'Debug.Print "WaveRender " & .dwFlag
If (.dwFlag And F_WO_ACTIVE) = 0 Then Exit Sub
.dwFlag = .dwFlag Or F_WO_NEED_UPDATE
lpWave1 = .lpWave1
LineIdx = .dwWaveByteWidth '像素指针
For I = 1 To .dwBmpHeight - 2
For J = 0 To .dwBmpWidth - 1
'
2024-11-23 11:54
2024-11-23 11:49
2024-11-23 11:11
2024-11-23 11:03
2024-11-23 10:49
2024-11-23 10:41
2024-11-23 10:07
2024-11-23 09:51