博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SQL语句进行插入
阅读量:4172 次
发布时间:2019-05-26

本文共 661 字,大约阅读时间需要 2 分钟。

 Connection conn = null;

  PreparedStatement pstm = null;
  ResultSet rs = null;
  conn = JDBC_Connection.getConnection();
  String sqlinsert ="insert into tbvideo(panoramaId,no,title,duration,publisher) values('"+panoramaId+"','"+no+"','"+title+"','"+duration+"','"+publisher+"')";
  
  try {
   pstm= conn.prepareStatement(sqlinsert);
    pstm.execute();
    System.out.print("kkkk");
  //  pstm.executeUpdate();
  } catch (SQLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }

 

 

 

1. 自动编号的字段不能显性插入。2. 数字值不要用单引号包围。3. 日期时间型数据用#号包围,而不是单引号。String sql2 = "insert into reply(pid, rTitle, rcontent, rauthor,rdate)
values(" +id+",'"+rtitle+"','"+re+"','"+author+"',#"+date+"#)";

转载地址:http://akdai.baihongyu.com/

你可能感兴趣的文章
在VS.NET的VC++中运行控制台程序后暂停
查看>>
Linux下rz,sz与ssh,SecureCRT的配合使用
查看>>
一个使用Pro*C实现增删改查的小例子
查看>>
Save could not be completed. Eclipse国际化的问题解决
查看>>
Xblo(JSP+Servlet+JavaBean+Oracle单用户Blog)
查看>>
Unable to use IEC module under PortablePython_1.1_py2.5.4
查看>>
实用英文地址书写格式
查看>>
在oracle中通过connect by prior来实现递归查询!
查看>>
百度空间如何才能另存为 mht
查看>>
How to Reset or Change Microsoft Office 2007 Product License Key or Volume License Key (VLK)
查看>>
使用java concurrent调用xmlp api生成pdf
查看>>
Oracle日期计算之INTERVAL
查看>>
Oracle PL/SQL之EXCEPTION
查看>>
Oracle PL/SQL之EXCEPTION -- WHEN OTHERS THEN
查看>>
Oracle PL/SQL之VARCHAR2 QUALIFIER
查看>>
Oracle PL/SQL之处理index不连续的table类型变量
查看>>
Oracle PL/SQL之嵌套表(Nested Table)
查看>>
Oracle PL/SQL之令人不解的提示(nls_date_format)
查看>>
Oracle PL/SQL之GROUP BY ROLLUP
查看>>
Oracle PL/SQL之GROUP BY CUBE
查看>>