第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

The method next() is undefined for the type Object ?

The method next() is undefined for the type Object ?

至尊寶的傳說(shuō) 2019-02-25 13:14:20
package com.test1; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public class Test2 extends JFrame{ Vector rowData,columnNames; JTable jt = null; JScrollPane jsp = null; PreparedStatement ps = null; Connection ct=null; ResultSet rs=null; public static void main(String[] args) { // TODO Auto-generated method stub } public Test2(Object rs, Object ps, Object ct){ columnNames = new Vector(); columnNames.add("學(xué)號(hào)"); columnNames.add("名字"); columnNames.add("性別"); columnNames.add("年齡"); columnNames.add("籍貫"); columnNames.add("系別"); rowData = new Vector(); try { Class.forName("com.mysql.jdbc.Driver"); ct = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3066/" + "book?CharacterEncoding=gbk","root","root"); ps = ((Connection) ct).prepareStatement("select * from stu"); rs = ((PreparedStatement) ps).executeQuery(); //標(biāo)記A,next下劃線報(bào)錯(cuò),The method getString(int) is undefined for the type Object //標(biāo)記B,getString下劃線報(bào)錯(cuò),連續(xù)4行,The method getString(int) is undefined for the type Object while(rs.next()){ Vector hang = new Vector(); hang.add( rs.getString(1)); hang.add(rs.getString(2)); hang.add(rs.getString(3)); hang.add(rs.getInt(4)); hang.add(rs.getString(5)); hang.add( rs.getString(6)); rowData.add(hang); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); //標(biāo)記C, .close報(bào)錯(cuò),The method close() is undefined for the type Object }finally{ try{ if(rs!=null ) rs.close(); if(ps!=null) ps.close(); if(ct!=null) ct.close(); }catch (Exception e){ e.printStackTrace(); } } jt = new JTable(rowData,columnNames); jsp = new JScrollPane(jt); this.add(jsp); this.setSize(400, 350); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } } 無(wú)法上傳圖片,標(biāo)記A標(biāo)記B標(biāo)記C,跟著教程碼的,教材沒(méi)報(bào)錯(cuò),很久了沒(méi)解決,謝謝,
查看完整描述

1 回答

?
陪伴而非守候

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超8個(gè)贊

public Test2(Object rs, Object ps, Object ct)
替換為
public Test2(ResultSet rs, PreparedStatement ps, Connection ct)

查看完整回答
反對(duì) 回復(fù) 2019-03-01
  • 1 回答
  • 0 關(guān)注
  • 5441 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)