📄 consumerregister.java
字号:
package server.consumer;
import java.util.*;
import java.sql.*;
/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class consumerRegister {
//consumerData data=new consumerData();
operateDb op=new operateDb();
ArrayList name=new ArrayList();
private void readName()
{
ResultSet rs=op.getRs("select "+consumerData.propety[0]+" from "+consumerData.TABLE);
try{
do {
name.add(rs.getString(consumerData.propety[0]));
}while(rs.next());
rs.close();}
catch(SQLException e){}
}
public boolean nameRepeated(String consumername)
{
readName();
for(int i=0;i<name.size();i++)
{
if(consumername.equals(name.get(i).toString()))
return true;
}
return false;
}
public String getInsertInfo(ArrayList array)
{
String str="INSERT INTO "+consumerData.TABLE+" (";
for(int i=0;i<consumerData.propeties;i++)
{
str+=consumerData.propety[i];
if(i<consumerData.propeties-1)
str+=",";
// else
// str+=")";
}
str+=") VALUES (";
for(int i=0;i<consumerData.propeties;i++)
{
str=str+"\'"+array.get(i).toString()+"\'";
if(i<consumerData.propeties-1)
str+=",";
}
str+=")";
return str;
}
public boolean insertInfo(ArrayList array)
{
String str=getInsertInfo(array);
return op.insertInfo(str);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -