附,我作的包
包1:
package lanxia.Dbopreator;
import java.sql.*;
import java.util.*;
import java.util.Vector;
public class Dbopreator
{
private Connection mycon;
private Statement stment;
private ResultSet rs;
private String dataSource;
private Vector vr;
public Dbopreator()
{
vr=new Vector();
mycon=null;
stment=null;
rs=null;
dataSource="sun.jdbc.odbc";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e)
{
System.out.print("can not found sun.jdbc.odbc.JdbcOdbcDriver");
}
}
public void Open(String usrName,String pasward )
{
try
{
mycon= DriverManager.getConnection(dataSource,usrName,pasward);
stment=mycon.createStatement();
}
catch(SQLException ee)
{
ee.printStackTrace();
}
}
public void Close()
{
try
{
rs.close();
}
catch(Exception ef)
{
ef.printStackTrace();
}
try
{
stment.close();
}
catch(Exception ef)
{
ef.printStackTrace();
}
try
{
mycon.close();
}
catch(Exception ef)
{
ef.printStackTrace();
}
}
public ResultSet execQuery(String sql)
{
try
{
rs=stment.executeQuery(sql);
}
catch(SQLException ef)
{
ef.printStackTrace();
}
Vector vtr=new Vector();
while(rs.next())
{
vtr.addElement(rs.)
}
return rs;
}
public int execupdate(String sql)
{
int falg=-1;
try
{
stment.executeUpdate(sql);
falg=1;
}
catch(SQLException ef)
{
ef.printStackTrace();
}
return falg;
}
public int execdelete(String sql)
{
int falg=-1;
try
{
stment.executeUpdate(sql);
falg=1;
}
catch(SQLException ef)
{
ef.printStackTrace();
}
return falg;
}
public int execInsert(String sql)
{
int v=-1;
;
try
{
stment.executeUpdate(sql);
v=0;
}
catch(SQLException ef)
{
ef.printStackTrace();
}
return v;
}
public boolean execselect(String sql)
{
boolean flag=false;
try
{
flag=stment.execute(sql);
}
catch(SQLException ef)
{
ef.printStackTrace();
}
return flag;
}
public void displaydata()
{
}
}
包2:
package lanxia.Stuinfo;
import lanxia.Dbopreator.*;
import java.sql.*;
import java.util.*;
public class Stuinfo
{
private String stu_name;
private int stu_num;
private String stu_age;
private String stu_sex;
private String stu_class;
private String stu_dep;
private String stu_address;
Stuinfo()
{
stu_name="";
stu_num=0;
stu_age="";
stu_sex="";
stu_class="";
stu_dep="";
stu_address="";
}
public String getname()
{
return stu_name;
}
public int getnumber()
{
return stu_num;
}
public String getsex()
{
return stu_sex;
}
public String getclass()
{
return stu_class;
}
public String getdepartment()
{
return stu_dep;
}
public String getaddress()
{
return stu_address;
}
public void addInfo(String sql)
{
Dbopreator dbc=new Dbopreator();//这是出错的代码段
dbc.Open(sa,"");
dbc.Close();
}
public void delInfo(String sql)
{
}
public void updateInfo(String sql)
{
}
}
问题为:
我在包2中应入包1好,编译包2总是出现找不到符号的错误;请高手帮忙