使用 sql 服务器数据库填充 jtable

populating jtable with sql server database

public InventoryJFrame() throws ClassNotFoundException {
    try {
        initComponents();
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver" );
        StringstringCon="jdbc:sqlserver://AAYANPC;databaseName=Qseal;user=sa;password=123";

        Connection con=DriverManager.getConnection(stringCon);
        Statement state=con.createStatement();
        ResultSet rs=state.executeQuery("select * from Qseal");
        ResultSetMetaData rsmetadata=rs.getMetaData();
        int columns=rsmetadata.getColumnCount();
        DefaultTableMode1 dtm=new DefaultTableMode1();
    }   
    catch (SQLException ex) {

        Logger.getLogger(InventoryJFrame.class.getName()).log(Level.SEVERE, null, ex);
    }
}

我在行 DefaultTableMode1 dtm=new DefaultTableMode1(); 中发现错误。错误是 "cannot find symbol" 并且在提示中它说在源包

中创建一个 pachkage DefaultTableName

根据What does a “Cannot find symbol” compilation error mean?

A "Cannot find symbol" error is about the identifiers. When your code is compiled, the compiler needs to work out what each and every identifier in your code means.

A "Cannot find symbol" error means that the compiler cannot do this. Your code appears to be referring to something that the compiler doesn't understand.

我想你在录音时有拼写错误 DefaultTableModel。它以字符 l 而不是数字 1.

结尾