日期:2014-05-20  浏览次数:21055 次

类中如何给变量赋值?
我想实现一个数据结构,但是赋值的时候,有问题,好像必须在方法里赋值
怎么解决这个问题?

public   class   SeekAttrib   {
String   sql;
mdbconn   mdb   =   new   mdbconn();
Seek   sa   =   new   Seek();
sql   =   "select   *   from   TableSeekAction   where   ID= "   +   SeekActionID;
ResultSet   rs   =   mdb.executeQuery(sql);
try
{
if   (rs.next())
{
String   nActionType   =   rs.getString( "nActionType ");
String   MenuState   =   rs.getString( "MenuState ");
String   Status   =   rs.getString( "Status ");
String   nFormStyle   =   rs.getString( "nFormStyle ");
String   MainLine   =   sa.Apostrophe(rs.getString( "MainLine "));
String   OrderStr   =   rs.getString( "OrderStr ");
String   bWrap   =   rs.getString( "bWrap ");
String   TitleBkColor   =   rs.getString( "TitleBkColor ");
String   TitleFgColor   =   rs.getString( "TitleFgColor ");
String   RowBkColor   =   rs.getString( "RowBkColor ");
String   RowFgColor   =   rs.getString( "RowFgColor ");
String   LineColor   =   rs.getString( "LineColor ");
String   SelFgColor   =   rs.getString( "SelFgColor ");
String   SelBkColor   =   rs.getString( "SelBkColor ");
String   FormHead   =   sa.Apostrophe(rs.getString( "FormHead "));
String   FormTail   =   rs.getString( "FormTail ");
String   TitleFont   =   rs.getString( "TitleFont ");
String   BodyFont   =   rs.getString( "BodyFont ");
String   DblClickAction   =   rs.getString( "DblClickAction ");
String   PrepID   =   " ";       //GetSeekFilter(rs,   PrepID);
String   ParentNode   =   rs.getString( "ParentNode ");
String   ParentSeekID   =   rs.getString( "ParentSeekID ");
String   MenuTitle   =   rs.getString( "MenuTitle ");
String   FootStyle   =   rs.getString( "FootStyle ");
String   ClickAction   =   rs.getString( "ClickAction ");
String   DefaultView   =   rs.getString( "DefaultView ");
String   TreeViewDepth   =   rs.getString( "TreeViewDepth ");
String   PageRecs   =   rs.getString( "PageRecs ");
String   UserDefineTitle   =   sa.Apostrophe(rs.getString( "UserDefineTitle "));
String   UserDefineBody   =   sa.Apostrophe(rs.getString( "UserDefineBody "));
String   ThumbNail   =   rs.getString( "ThumbNail ");
String   BodyBack   =   rs.getString( "BodyBack ");
String   MenuBack   =   rs.getString( "MenuBack ");
String   MenuColor   =   rs.getString( "MenuColor ");
String   ToolBack   =   rs.getString( "ToolBack ");
String   ToolColor   =   rs.getString( "ToolColor ");
String   ActionText   =   rs.getString( "ActionText ");
}
}
catch(SQLException   e)
{
System.out.print( "GetSeekActionAttrib: "   +   e.getMessage());