当前位置: 技术问答>java相关
新手用jbuilder,很简单的问题。
来源: 互联网 发布时间:2015-10-03
本文导语: 我写了projector———》application——Designer页设计窗体,在窗体中放入一个JscrollPane 和JtextArea 及一个按钮。在一个按钮里写了: void jToggleButton1_actionPerformed(ActionEvent e) { try { Class.forName("com.s...
我写了projector———》application——Designer页设计窗体,在窗体中放入一个JscrollPane 和JtextArea 及一个按钮。在一个按钮里写了:
void jToggleButton1_actionPerformed(ActionEvent e)
{
try
{
Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
String url=" jdbc:sybase:Tds:10.68.4.233:5000/test";
String user="sa";
String passwords="";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.CreatStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Resulset rs=stmt.excuteQuery("select * from test");
String sql;
}
catch (Exception e1)
{}
}
}
却提示:
class Connection not found in class sy_demo.Frame
Variable DriverManager not found in class sy_demo.Frame
class Statement not found in class sy_demo.Frame
Variable Statement not found in class sy_demo.Frame
Variable RusutlSet not found in class sy_demo.Frame
......
void jToggleButton1_actionPerformed(ActionEvent e)
{
try
{
Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
String url=" jdbc:sybase:Tds:10.68.4.233:5000/test";
String user="sa";
String passwords="";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.CreatStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Resulset rs=stmt.excuteQuery("select * from test");
String sql;
}
catch (Exception e1)
{}
}
}
却提示:
class Connection not found in class sy_demo.Frame
Variable DriverManager not found in class sy_demo.Frame
class Statement not found in class sy_demo.Frame
Variable Statement not found in class sy_demo.Frame
Variable RusutlSet not found in class sy_demo.Frame
......
|
添入import java.sql.*;
|
没有import包的缘故................
|
还的加上这些........
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;