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

📄 standardsoftware.java

📁 软件上传下载网站,上传用户经过注册成为本站会员就可将将软件上传到本网站
💻 JAVA
字号:
package downreg;
import java.sql.*;
public class standardSoftware
{  //int   i=0;//序列号,自动加1
  int    L_Id=0;
  int    S_Id=0;
  String S_Name="";
  String S_Size="";
  String S_Language="";
  String S_Environment="";
  String S_Type="";
  String S_Function="";
  int    I_Id=0;
  String S_PassTime="0000-00-00 00:00:00";
  String S_SavePath="";
  String S_Developer="";
  String S_DHomepage="";
  String S_DEmail="";
  int S_Grade=0;
  float S_Price=0;
  int S_TotalTimes=0;
  int S_WeekDTimes=0;
  int S_MonthDTimes=0;
 String S_FirSort="";
 String S_SecSort="";

   Connection con = null;
   Statement stmt = null;
   ResultSet rs = null;
  String tableName="software_1";
  public  standardSoftware()
  {
   String url="";
   String driverName="com.mysql.jdbc.Driver";
   String userName="root";
   String userPasswd="324802";
   String dbName="downreg";
   try
      {
        Class.forName(driverName).newInstance();
        url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd+"&useUnicode=true&characterEncoding=gb2312";
        con= DriverManager.getConnection(url);
        stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
      }
   catch (Exception e)
     {
     }
  }

  public void setL_Id(int id)
  {
   L_Id=id;
  }

  public void setS_Id(int id)
  {
   S_Id=id;
  }
  public void setS_Name(String name)
  {
   S_Name=name;
  }
  public void setS_Size(String size)
  {
  S_Size=size;
  }
  public void setS_Language(String language)
  {
  S_Language=language;
  }
  public void setS_Environment(String environment)
  {
  S_Environment=environment;
  }
  public void setS_Type(String type)
  {
  S_Type=type;
  }
  public void setS_Function(String function)
  {
  S_Function=function;
  }
  public void setI_Id(int id)
  {
  I_Id=id;
  }
  public void setS_PassTime(String passtime)
  {
  S_PassTime=passtime;
  }
  public void setS_SavePath(String savepath)
  {
  S_SavePath=savepath;
  }
  public void setS_Developer(String developer)
  {
  S_Developer=developer;
  }
  public void setS_DHomepage(String DHomepage)
  {
  S_DHomepage=DHomepage;
  }
  public void setS_DEmail(String Demail)
  {
  S_DEmail=Demail;
  }
  public void setS_Grade(int grade)
  {
  S_Grade=grade;
  }
   public void setS_Price(float price)
  {
   S_Price=price;
  }
   public void setS_TotalTimes(int Times )
  {
   S_TotalTimes=Times;
  }
  public void setS_WeekDTimes(int WeekDTimes )
  {
   S_WeekDTimes=WeekDTimes;
  }
  public void setS_MonthDTimes(int MonthDTimes )
  {
   S_MonthDTimes=MonthDTimes;
  }
  public void setS_FirSort(String FirSort)
  {
   S_FirSort=FirSort;
  }
   public void setS_SecSort(String SecSort)
  {
   S_SecSort=SecSort;
  }
 public int getL_Id()
  {
   return L_Id;
  }


 public int getS_Id()
  {
   return S_Id;
  }
  public String getS_Name()
  {
   return S_Name;
  }
  public String getS_Size()
  {
  return S_Size;
  }
  public String getS_Language()
  {
  return S_Language;
  }
  public String getS_Environment()
  {
  return S_Environment;
  }
  public String getS_Type()
  {
  return S_Type;
  }
  public String getS_Function()
  {
  return S_Function;
  }
  public int getI_Id()
  {
  return I_Id;
  }
  public String getS_PassTime()
  {
  return S_PassTime;
  }
  public String  getS_SavePath()
  {
  return S_SavePath;
  }
  public String getS_Developer()
  {
  return S_Developer;
  }
  public String getS_DHomepage()
  {
  return S_DHomepage;
  }
  public String getS_DEmail()
  {
  return S_DEmail;
  }

 public int getS_Grade()
  {
   return S_Grade;
  }
   public float getS_Price()
  {
   return S_Price;
  }
   public int getS_TotalTimes()
  {
  return  S_TotalTimes;
  }
  public int getS_WeekDTimes()
  {
   return S_WeekDTimes;
  }
  public int getS_MonthDTimes()
  {
   return S_MonthDTimes;
  }
  public String getS_FirSort()
  {
   return S_FirSort;
  }
   public String getS_SecSort()
  {
   return S_SecSort;
  }


public void deleteAll()   //delete all the records
{
try{

  String deleteAll="delete from "+tableName;
  stmt.executeUpdate(deleteAll);
  }
  catch(Exception e)
  {
  }
}

public ResultSet getFree_Software()
{
 try
 {
 String s="select * from  software_1 where S_Price=0";
 rs=stmt.executeQuery(s);

 }
 catch(Exception e)
 {
 }
 return rs;
}
public  void deleteFS()
{

  try
 {
 String s="delete from  software_1 where S_Price=0" ;
 stmt.executeUpdate(s);


 }
 catch(Exception e)
 {

 }
}


public ResultSet getSingleSF(int id)
{
try
 {
 String s="select * from  software_1 where L_Id="+"'"+id+"'";
 rs=stmt.executeQuery(s);

 }
 catch(Exception e)
 {
 }
 return rs;

}




public ResultSet getRegister_Software()
{
 try
 {
 String s="select * from  software_1 where S_Price!=0";
 rs=stmt.executeQuery(s);

 }
 catch(Exception e)
 {
 }
 return rs;
}

public void deleteRS()
{
  try
 {
 String s="delete from  software_1 where S_Price!=0";
 stmt.executeUpdate(s);


 }
 catch(Exception e)
 {

 }
}




public void delete(int id)  // delete  a record every time
{
try
{

 String condition="delete from "+tableName+" where L_Id='"+id+"'";
 stmt.executeUpdate(condition);

}
catch(Exception e)
{
}
}
public void update(int id,int dateDTimes,int weekDTimes,int monthDTimes,String name,String firSort,String secSort,String savePath,float price ) //Update the records
{
try
{

String condition="update tableName set S_DateDTimes="+dateDTimes+","+"S_WeekDTimes="+weekDTimes+","+"S_MonthDTimes="+monthDTimes+
","+"S_FirSort="+firSort+","+"S_SecSort="+secSort+","+"S_SavePath="+savePath+","+"S_Price="+price+"where L_Id="+"'"+id+"'"+"or"+"S_Name="+"'"+name+"'" ;   //this sentence is wrong,please  correct  it
stmt.executeUpdate(condition);
}
catch(Exception e)
{
}

}
public ResultSet LookStandardSW(int id) //查看合格软件
{
try
{

String condition="select * from "+tableName+" where L_Id='"+id+"'";
rs=stmt.executeQuery(condition);

}
catch(Exception e)
{
}
 return rs ;
}

public ResultSet LookRegisterSW() //查看收费软件
{
try
{

String condition="select * from tableName where S_Price!="+"'"+0+"'";
rs=stmt.executeQuery(condition);

}
catch(Exception e)
{
}
 return rs ;
}

public ResultSet LookFreeSW() //查看免费软件
{
try
{

String condition="select * from tableName where S_Price="+"'"+0+"'";
rs=stmt.executeQuery(condition);

}
catch(Exception e)
{
}
 return rs ;
}

public void close()
{
try
{
if(rs!=null)
{
  rs.close();
}
if(stmt!=null)
{
  stmt.close();
}
if(con!=null)
{
  con.close();
}
}
catch (SQLException e)
{
}
}
}

⌨️ 快捷键说明

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