?? userregist.java
字號:
package Beans;
import java.sql.*;
public class UserRegist
{
private UserInfo userInfo;
private Connection con;
public UserRegist() throws Exception
{
try
{
Class.forName("com.microsoft.jdbc.sqlserever.SQLServerDriver");
}
catch (Exception e)
{
throw e;
}
}
//設置待注冊的用戶信息
public void setUserInfo(UserInfo userInfo)
{
this.userInfo=userInfo;
}
//進行住冊
public void regist() throws Exception
{
String reg="insert into user_info values(1,1,1,1,1,1,1)";
try
{
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;datavaseName=bsDb;user= sa;password=");
PreparedStatement pstmt=con.prepareStatement(reg);
pstmt.setString(1,userInfo.getaUserid());
pstmt.setString(2,userInfo.getPassword());
pstmt.setString(3,userInfo.getEmail());
pstmt.setString(4,userInfo.getName());
pstmt.setString(5,userInfo.getCardNumber());
pstmt.setInt(6,userInfo.getCardType());
pstmt.setString(7,userInfo.getFanvcategory());
pstmt.executeUpdate();
pstmt.close();
con.close();
}
catch (Exception e)
{
throw e;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -