1.Qt的textBrowser更新显示,想实现每秒刷出一条信息;而不是函数执行完毕后,一起刷出全部的内容。
2.请教一个关于HAL
3.ja连接oracle数据库ja.sql.SQLException: 无效的列索引问题
ja.sql.SQLException: 无效的列索引
无效的列索引
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja:207)
atoracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.ja:5328)
atoracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.ja:5320)
at untitled5.addreader1.validID(addreader1.ja:128)
at untitled5.addreader1.jButton1_actionPerformed(addreader1.ja:)
at untitled5.addreader1_jButton1_actionAdapter.actionPerformed(addreader1.ja:175)
at jax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at jax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.setPressed(Unknown Source)
at jax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at ja.awt.Component.processMouseEvent(Unknown Source)
at jax.swing.JComponent.processMouseEvent(Unknown Source)
at ja.awt.Component.processEvent(Unknown Source)
at ja.awt.Container.processEvent(Unknown Source)
at ja.awt.Component.dispatchEventImpl(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Window.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.EventQueue.dispatchEvent(Unknown Source)
at ja.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.run(Unknown Source)
代码:String driverName = "oracle.jdbc.OracleDriver";
Driver driver = (Driver) Class.forName(driverName).newInstance();
//连接数据库
Connection con = DriverManager.getConnection(
"jdbc:oracle:thin:@LONG:1521:orcl", "sysman", "tongfang");
PreparedStatement pstmt = con.prepareStatement(
" insert into reader values(?)");
pstmt.setString(1, str1);
pstmt.setString(2,str2);
pstmt.setString(3,str3);
pstmt.setString(4,str4);
ResultSet res = pstmt.executeQuery();
ja.sql.SQLException: 无效的列索引
无效的列索引
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.ja:207)
atoracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.ja:5328)
atoracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.ja:5320)
at untitled5.addreader1.validID(addreader1.ja:128)
at untitled5.addreader1.jButton1_actionPerformed(addreader1.ja:)
at untitled5.addreader1_jButton1_actionAdapter.actionPerformed(addreader1.ja:175)
at jax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at jax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.setPressed(Unknown Source)
at jax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at ja.awt.Component.processMouseEvent(Unknown Source)
at jax.swing.JComponent.processMouseEvent(Unknown Source)
at ja.awt.Component.processEvent(Unknown Source)
at ja.awt.Container.processEvent(Unknown Source)
at ja.awt.Component.dispatchEventImpl(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.processMouseEvent(Unknown Source
at ja.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Window.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.EventQueue.dispatchEvent(Unknown Source)
at ja.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.run(Unknown Source)
代码:String driverName = "oracle.jdbc.OracleDriver";
Driver driver = (Driver) Class.forName(driverName).newInstance();
//连接数据库
Connection con = DriverManager.getConnection(
"jdbc:oracle:thin:@LONG:1521:orcl", "sysman", "tongfang");
PreparedStatement pstmt = con.prepareStatement(
" insert into reader values(?)");
pstmt.setString(1, str1);
pstmt.setString(2,str2);
pstmt.setString(3,str3);
pstmt.setString(4,str4);
ResultSet res = pstmt.executeQuery();
Qt的textBrowser更新显示,想实现每秒刷出一条信息;而不是函数执行完毕后,一起刷出全部的内容。
Exception in thread "AWT-EventQueue-0" ja.lang.Error: Unresolved compilation problem:
Cannot invoke trim() on the array type char[]
at student.Info_Manage.actionPerformed(Info_Manage.ja:76)
at jax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at jax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.setPressed(Unknown Source)
at jax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at ja.awt.Component.processMouseEvent(Unknown Source)
at jax.swing.JComponent.processMouseEvent(Unknown Source)
at ja.awt.Component.processEvent(Unknown Source)
at ja.awt.Container.processEvent(Unknown Source)
at ja.awt.Component.dispatchEventImpl(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Window.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.EventQueue.dispatchEvent(Unknown Source)
at ja.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" ja.lang.Error: Unresolved compilation problem:
Cannot invoke trim() on the array type char[]
at student.Info_Manage.actionPerformed(Info_Manage.ja:76)
at jax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at jax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.setPressed(Unknown Source)
at jax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at ja.awt.Component.processMouseEvent(Unknown Source)
at jax.swing.JComponent.processMouseEvent(Unknown Source)
at ja.awt.Component.processEvent(Unknown Source)
at ja.awt.Container.processEvent(Unknown Source)
at ja.awt.Component.dispatchEventImpl(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Window.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.EventQueue.dispatchEvent(Unknown Source)
at ja.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" ja.lang.Error: Unresolved compilation problem:
Cannot invoke trim() on the array type char[]
at student.Info_Manage.actionPerformed(Info_Manage.ja:76)
at jax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at jax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at jax.swing.DefaultButtonModel.setPressed(Unknown Source)
at jax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at ja.awt.Component.processMouseEvent(Unknown Source)
at jax.swing.JComponent.processMouseEvent(Unknown Source)
at ja.awt.Component.processEvent(Unknown Source)
at ja.awt.Container.processEvent(Unknown Source)
at ja.awt.Component.dispatchEventImpl(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at ja.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at ja.awt.Container.dispatchEventImpl(Unknown Source)
at ja.awt.Window.dispatchEventImpl(Unknown Source)
at ja.awt.Component.dispatchEvent(Unknown Source)
at ja.awt.EventQueue.dispatchEvent(Unknown Source)
at ja.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at ja.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.pumpEvents(Unknown Source)
at ja.awt.EventDispatchThread.run(Unknown Source)
请教一个关于HAL
写一个时间函数,定义一个QTimer对象,这个timer的interval设置为1000,时间一到就输出:
QTimer timer;
timer.setInterval(1000);
timer.start();
connect(&timer,SIGNAL(timeOut()),this,SLOT(myTimerout()));
void thisObject::myTimerOut()
{
ui->textBrowser->end(QString("hello ===>> %1").arg(i));
}
(这个timer必须是你的类成员对象,或者指针对象,不能是局部的哈)
ja连接oracle数据库ja.sql.SQLException: 无效的列索引问题
任务数组tasksArr[ ] 包含Hal_ProcessEvent函数;Hal_ProcessEventHalKeyPoll();HalKeyPoll()函数想要HAL_KEY_SW_6IO应关系
这和用什么用户无关,只要能连上数据库、并且使用的用户对该表有插入权限,就没问题。现在出现的“无效的列索引的异常”,是指在语句pstmt.setString(2,str2);中,列索引2是无效的,因为sql语句中只有一个问号。PreparedStatement 对象中的
setString方法的第一个参数是列索引,这个参数的取值范围是和sql语句中的问号数量对应的,sql语句中有n个问号,setString方法的第一个参数就应该从1到n,如果不在这个范围之内,就会出列索引无效的异常。