会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132420个问题

为什么后面的选择器不生效呢  改变之后页面上的显示不会变,
而且时间选择器开始的时间前面的时间也可以选择。

// pages/picker/picker.js
Page({
    data:{
      array:["吃","喝","玩","乐"],
      index:3,
      multiArray:[
        ["中国","日本"],
        ["辽宁","四川","江苏"],
        ["本溪","沈阳", "大连"]
      ],
      multiIndex:[0,0,0],
      time:'12:01',
      date:"2023-02-27"
    },
    bindPickerChange(e){
      this.setData({
        //e.detail,value:可以获取用户选择的内容下标
        index:e.detail.value
      })

    },
    bindMultiPickerChange(e){
      this.setData({
        //e.detail,value:可以获取用户选择的内容下标
        multiIndex:e.detail.value
      })

    },
    bindTimeChange(e){
      this.setData({
        time:e.detail.value
      })
    },
    bindDateChange(e){
      this.setData({
        date:e.detail.value
      })
    }
})

<!--pages/picker/picker.wxml-->
<view>普通选择器</view>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
<view class="picker">
  当前选择:{{array[index]}}
</view>
</picker>

<view>多列选择器</view>
<picker mode="multiSelector" bindChange="bindMultiPickerChange" value="{{multiIndex}}" range="{{multiArray}}">
<view class="picker">
  当前选择:{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}},{{multiArray[2][multiIndex[2]]}}
</view>
</picker>


<view>时间选择器</view>
<picker mode="time" value="{{time}}" start="09:01" end="21:01" bindChange="bindTimeChange">
  <view class="picker">
    当前选择:{{time}}
  </view>
</picker>

<view>日期选择器</view>
<picker mode="date" value="{{date}}" start="2000-09-01" end="2030-09-01" bindChange="bindDateChange">
  <view>
    当前选择:{{date}}
  </view>
</picker>


WEB前端全系列/第十四阶段:微信小程序/小程序组件 32927楼
JAVA 全系列/第八阶段:SpringBoot与MybatisPlus/Spring Boot旧 32928楼
JAVA 全系列/第八阶段:SpringBoot与MybatisPlus/MybatisPlus 32930楼
Python 全系列/第四阶段:函数式编程和核心特性/正则表达式 32932楼
Python 全系列/第一阶段:Python入门/Python入门(动画版) 32934楼
JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 32936楼
Python 全系列/第一阶段:Python入门/序列 32939楼

哪里错了

package com.itbaizhan;

import java.io.*;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
* Blob类型操作测试类
*/
public class BlobTest {
   /**
    *movie表中插入数据
    */
   public void insertMoive(String moviename, InputStream is){
       Connection connection = null;
       PreparedStatement ps = null;
       try{
           //获取链接
           connection = JdbcUtils.getConnection();
           //获取PrepareStatement对象
           ps = connection.prepareStatement("insert into movie values(default,?,?)");
           //绑定参数
           ps.setString(1,moviename);
           ps.setBlob(2,is);
           ps.executeUpdate();
       }catch (Exception e){
           e.printStackTrace();
       }finally {
           JdbcUtils.closeResource(ps,connection);
       }
   }
   /**
    * 根据影片ID查询影片信息
    * @param movieid
    */
   public void selectMovieBlob(int movieid){
       Connection conn =null;
       PreparedStatement ps = null;
       ResultSet rs = null;
       try{
           //获取连接
           conn =JdbcUtils.getConnection();
           //创建PreparedStatement对象
           ps = conn.prepareStatement("select * from movie where movieid = ?");
           //绑定参数
           ps.setInt(1,movieid);
           //执行sql
           rs = ps.executeQuery();
           while(rs.next()){
               int id = rs.getInt("movieid");
               String name = rs.getString("moviename");
               System.out.println(id+" "+name);
               //获取blob类型的数据
               Blob blob = rs.getBlob("poster");
               //获取能够从Blob类型的列中读取数据的IO
               InputStream is = blob.getBinaryStream();
               //创建文件输出字节流对象
               OutputStream os = new FileOutputStream(id+"_"+name+".jpg");
               //操作流完成文件的输出处理
               byte[] buff = new byte[1024];
               int len;
               while((len = is.read(buff)) != -1){
                   os.write(buff,0,len);
               }
               os.flush();
               is.close();
               os.close();
           }
       }catch(Exception e){
           e.printStackTrace();
       }finally{
           JdbcUtils.closeResource(rs,ps,conn);
       }
   }


   public static void main(String[] args) throws FileNotFoundException {
       BlobTest b = new BlobTest();
//        InputStream is = new FileInputStream(new File("D:/截图/数据库/MySQLDML操作/MySql Blob类型.jpg"));
//        b.insertMoive("Blob类型",is);
       b.selectMovieBlob(1);
   }
}


java.io.FileNotFoundException: 1Blob??.jpg (文件名、目录名或卷标语法不正确。)

at java.base/java.io.FileOutputStream.open0(Native Method)

at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)

at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)

at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:126)

at com.itbaizhan.BlobTest.selectMovieBlob(BlobTest.java:60)

at com.itbaizhan.BlobTest.main(BlobTest.java:83)


Process finished with exit code 0


JAVA 全系列/第三阶段:数据库编程/JDBC技术 32940楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637