public void actionPerformed(ActionEvent evt)
btnEnter.addActionListener(this);publicvoidactionPerformed(ActionEventevt){Objectobj=...
btnEnter.addActionListener(this);
public void actionPerformed(ActionEvent evt)
{
Object obj=evt.getSource();
try
{
if(obj==btnEnter)
{
String str1="INSERT INTO StBasicInfo VALUES(?,?,?)";
String[] values=new String[3];
values[0]=txtStNo.getText();
values[1]=txtStName.getText();
//values[2]=txtStSex.getText();
values[2]=txtStHometown.getText();
op1.insert(str1,values);
txtStNo.setText("");
txtStName.setText("");
//txtStSex.setText("");
txtStHometown.setText("");
}
if(obj==btnCancel)
{
txtStNo.setText("");
txtStName.setText("");
//txtStSex.setText("");
txtStHometown.setText("");
}
}
catch(Exception e)
{
System.out.println("Error:"+e);
}
}
--------------------Configuration: <Default>--------------------
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 非法的表达式开始
public void actionPerformed(ActionEvent evt)
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 非法的表达式开始
public void actionPerformed(ActionEvent evt)
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 需要 ';'
public void actionPerformed(ActionEvent evt)
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 需要 ';'
public void actionPerformed(ActionEvent evt)
^
4 错误
Process completed.
完全照书上抄的,就是报错,一下午了 郁闷死了 展开
public void actionPerformed(ActionEvent evt)
{
Object obj=evt.getSource();
try
{
if(obj==btnEnter)
{
String str1="INSERT INTO StBasicInfo VALUES(?,?,?)";
String[] values=new String[3];
values[0]=txtStNo.getText();
values[1]=txtStName.getText();
//values[2]=txtStSex.getText();
values[2]=txtStHometown.getText();
op1.insert(str1,values);
txtStNo.setText("");
txtStName.setText("");
//txtStSex.setText("");
txtStHometown.setText("");
}
if(obj==btnCancel)
{
txtStNo.setText("");
txtStName.setText("");
//txtStSex.setText("");
txtStHometown.setText("");
}
}
catch(Exception e)
{
System.out.println("Error:"+e);
}
}
--------------------Configuration: <Default>--------------------
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 非法的表达式开始
public void actionPerformed(ActionEvent evt)
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 非法的表达式开始
public void actionPerformed(ActionEvent evt)
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 需要 ';'
public void actionPerformed(ActionEvent evt)
^
C:\Documents and Settings\Administrator\桌面\新建文件夹\UserHome.java:244: 需要 ';'
public void actionPerformed(ActionEvent evt)
^
4 错误
Process completed.
完全照书上抄的,就是报错,一下午了 郁闷死了 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询