问题入题  我的领悟能力不佳,请说详细,最好能来段代码

解决方案 »

  1.   

    05用varbinary(max)\nvarchar(max)等
    2000用Image\text\ntext
      

  2.   

    如果为了性能,一般会选择存文件url地址,文件存放于磁盘中
    如果为了文件的安全性,那可以存放在ntext,image字段中
    写入文件需要程序读二进制来处理,具体你可以上百度google一下
      

  3.   

    吧你的数据转换成 二进数据 
    05用Image\varbinary(max)等 
    2000用Image\text\ntext
      

  4.   

    一般的思想是存储地址,然后在WEB中html中写入相应的标签即可!
      

  5.   

    用java写的:public class 数据库存图片 {
     private Connection con = null; public 数据库存图片() throws SQLException, ClassNotFoundException {
      Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      con = DriverManager
        .getConnection(
          "jdbc:sqlserver://127.0.0.1;databasename=?",
          "sa", "");
     } private void savaPiture() throws SQLException, ClassNotFoundException,
       FileNotFoundException {
      String picn = "C:\\Documents and Settings\\Administrator\\My Documents\\My Pictures\\IMG0008A.jpg";
      File file = new File(picn);
      long filelong = file.length();
      int flong = (int) filelong;
      FileInputStream fis = new FileInputStream(file);
      String sqli = "insert into PICTURE values(?)";
      PreparedStatement ps = con.prepareStatement(sqli);
      ps.setBinaryStream(1, fis, flong);
      ps.execute();
     } private void readPicture() throws SQLException, ClassNotFoundException,
       IOException {  String sqlimg = "select image from PICTURE";
      PreparedStatement psi = con.prepareStatement(sqlimg);
      ResultSet rsi = psi.executeQuery();
      if (rsi.next()) {
       System.out.println("进入if");
       String path = "main.jpg";
       File file = new File(path);
       FileOutputStream sout = new FileOutputStream(file);
       InputStream in = rsi.getBinaryStream(1);
       byte b[] = new byte[1024];
       int i = in.read(b);
       while (i > -1) {
        System.out.println("进入循环");
        sout.write(b, 0, i);
        i = in.read(b);
       }
       sout.flush();
       sout.close();
      }
     } public static void main(String[] args) throws SQLException,
       ClassNotFoundException, IOException {
      new 数据库存图片().readPicture();//取图片
      //new 数据库存图片().savaPiture();//存图片
     }
    }
      

  6.   

    如果是放数据库里,则一般是转换为二进制,然后保存到类型为image的字段中,取出来时再转换。
    否则只保存文件的路径,文件保存再硬盘里