`
woshixushigang
  • 浏览: 575859 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

String[] args = new String[]{sql.toString()}

SQL 
阅读更多

本题中 StringBuffer sql = new StringBuffer();

其中sql.toString结果为: '测试用户1','男'

String[] args = new String[]{sql.toString()}

args.length结果为1

显然不是我们需要的。

注意:new String[]{"","",""}:这种形式的才正确。

 

 

分享到:
评论

相关推荐

    jdbc连接代码

    String sql = sqlbuffer.toString(); // String sql ="INSERT INTO UserInfo (loginId,loginPwd) VALUES('"+ // loginId +"','"+loginPwd+"')"; // Statement作用是向数据库中发送sql语句,并告诉...

    Microsoft.SQLServer.ManagedDTS.dll文件

    static void Main(string[] args) { // 创建连接到SSIS服务器的Application对象 Application app = new Application(); // 加载SSIS包 Package package = app.LoadPackage(@"C:\SSIS\Packages\MySSISPackage...

    Excel POI读取封装(文件+示范代码)

    DataType stued=new StuEducationImpl(); if(e.isForeign()){ String[] data=(String[])stued.dealDataType(e,excelvalue); obj=convertDataType(data[1],data[0].toString().getClass()); datamap.put(e....

    c连接access数据库手记.pdf

    static void Main(string[] args) { // 假设我们有mdb和accdb文件 string connectionStringMdb = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\path\\to\\Database1.mdb"; string connectionStringAccdb...

    JAVA连接ACCESS数据库.pdf

    public static void main(String[] args) { String str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "C:\\path\\to\\your\\database.mdb"; try { Connection con = DriverManager.getConnection(str);...

    Javaswing登录页面的实现

    private JTextArea userText=new JTextArea("请输入内容",7, 30); // 获取登录名 private JLabel passLabel = new JLabel("密 码:"); // 创建PassJLabel private JPasswordField passText = new JPasswordField...

    java中时间格式的转换.docx

    java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); System.out.println("转换后的SQL Date为: " + sqlDate); } } ``` 通过调用`java.sql.Date`的构造函数,并传入`java.util.Date`对象的毫秒...

    JAVA编写的图书馆管理系统

    String s=new String(b); text.append(s); Thread.sleep(200); } }catch(InterruptedException e){} catch(IOException e){} } } new Help2(); } else if(e.get...

    java技巧

    public static void main(String[] args) { String dStr = "2001.12.12-08.23.21"; Date d = null; SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd-HH.mm.ss"); try { d = sdf.parse(dStr); } ...

    java 类型转换 大全

    public static void main(String[] args) { Date day; day = TypeChange.stringToDate("2003-11-3"); String strDay = TypeChange.dateToString(day); System.out.println(strDay); } } ``` 通过以上示例,...

    JavaGUI工具:导出Oralce数据库脚本

    StringBuilder insertSql = new StringBuilder("INSERT INTO table_name VALUES("); for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { if (i > 1) insertSql.append(", "); insertSql.append("'...

    java sql注入l

    33 String name = params.nextElement().toString(); 34 //System.out.println("name===========================" + name + "--"); 35 //得到参数对应值 36 String[] value = req.getParameterValues(name); ...

    java根据实体类生成Hibernate映射文件

    public static void main(String[] args) { Class<?> entityClass = User.class; // 替换为你的实体类 Properties props = new Properties(); // 可以用来配置生成的映射文件,如表名前缀等 String className =...

    geojson-geometry-shp格式相互转化总结

    public static void main(String[] args) throws IOException, SQLException, ClassNotFoundException { Connection conn = null; conn = DBUtil.getConn(); String path = "C:\\Users\\wang\\Desktop\\结果\\...

    ADO.NET简要操作学习笔记

    static void Main(string[] args) { string connectionString = "Data Source=localhost;Initial Catalog=PTAuthDB;User ID=sa;Password=asasas;"; using (SqlConnection connection = new SqlConnection...

    java实现读取html网页文件

    public static void main(String[] args) { String htmlFilePath = "path_to_your_html_file.html"; String url = "jdbc:mysql://localhost:3306/your_database"; String user = "username"; String password =...

    spring+netty+mybatis整合实例

    public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); ServerBootstrap bootstrap = context.getBean...

    springmybatis

    public static void main(String[] args) { SqlSession session = sqlSessionFactory.openSession(); try { User user = (User) session.selectOne("com.yihaomen.mybatis.models.UserMapper.selectUserByID", 1...

Global site tag (gtag.js) - Google Analytics