VFP将图片或其他文件保存到SQL Server的Text类型字段或者Access
*-- vfp8.0、9.0 *-- 保存 1、将 图片 文件 用 Filetostr ()转成字符A。 2、再用 Strconv (字符A,13)将字符A转成base64编码数据的字符B。 3、将字符B 保存 到SQL Server的Text 类型 字段 或者 Access的 备注 字段 。 *-- 还原 或 显示 1、用 Strconv (字符B,
*-- vfp8.0、9.0
*--保存1、将图片文件用 Filetostr()转成字符A。
2、再用 Strconv("字符A",13)将字符A转成base64编码数据的字符B。
3、将字符B保存到SQL Server的Text类型字段或者Access的备注字段。
*--还原或显示
1、用 Strconv("字符B",14)将base64编码数据还原成未编码的数据字符A。
2、用 Strtofile()转成图片文件或把字符A覆给Image控件的PictureVal
属性来显示
*--图片例子
* 保存
lcTextString=Strconv(Filetostr("路径\图片名A"),13)&&
base64编码数据,可以将此数据(lcTextString)保存
* 还原
=Strtofile(Strconv(lcTextString或表字段,14),"路径\图片名B")&&
将字符还原base64编码前数据,还原成文件
Thisform.Image1.Picture="路径\图片名B"&&
将还原后的图片覆给Image控件的的Picture属性
* 或
Thisform.Image1.PictureVal=Strconv(lcTextString,14)&&
将字符还原base64编码前数据后直接覆给Image控件的PictureVal属性(VFP9.0)
*--注:
以上方法除了可以对图片文件操作外,对其他文件如Word,文本,Exe,音频,视频等文件均可,但文件不要过大,否则速度慢。
*------------------
此方法也适用于DBF表的Memo字段(推荐用二进制备注字段,普通备注字段,在代码页有变化的时候会自动转变的,会破坏字段内容,二进制备注字段就不会。
如果直接用dbf二进制备注字段保存任何文件内容,那么可以直接用 Filetostr/Strtofile函数,不需要转成base64(SQL或Access需要转成base64),因为vfp没unicode功能,所有二进制文件功能都可用字符串函数来处理。)。
如果是DBF表的Memo字段,就直接用下面备注字段专用的命令,而且还可以保存和还原大文件(注:不管是什么数据库,不建议将大量大文件保存至表中),用Filetostr/Strtofile函数对文件大小是有限制的。
* 保存:
Append Memo Memo字段名From
文件名Overwrite
* 还原:
Copy Memo Memo字段名To
生成文件名
*------------------
如果是VFP9.0建议改为使用 Blob 类型字段(对应SQL Server的Image或Text类型),它可以存储任何类型的数据。这样不需要使用 ActiveX,直接使用 vfp 自带的Image控件的PictureVal
属性即可显示 bmp/gif/png/jpg/tif 等格式的图片。
Blob 类型字段要比上面方法好,因为前一种方法有一个缺点就是转成Base64后,数据变大了,不利于网络负载。
至于Blob类型字段的文件存储和还原
*存储
Replace Blob字段With Filetostr("D:\文件全名")
*还原
=Strtofile(Blob字段,"d:\文件全名")
使用通用字段是已过时的技术,而且存在很多的弊病,例如:放入通用字段的图像没有绝对可靠的方法重新再保存为磁盘文件。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











With the continuous development of social media, Xiaohongshu has become a platform for more and more young people to share their lives and discover beautiful things. Many users are troubled by auto-save issues when posting images. So, how to solve this problem? 1. How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? 1. Clear the cache First, we can try to clear the cache data of Xiaohongshu. The steps are as follows: (1) Open Xiaohongshu and click the "My" button in the lower right corner; (2) On the personal center page, find "Settings" and click it; (3) Scroll down and find the "Clear Cache" option. Click OK. After clearing the cache, re-enter Xiaohongshu and try to post pictures to see if the automatic saving problem is solved. 2. Update the Xiaohongshu version to ensure that your Xiaohongshu

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

With the popularity of Douyin short videos, user interactions in the comment area have become more colorful. Some users wish to share images in comments to better express their opinions or emotions. So, how to post pictures in TikTok comments? This article will answer this question in detail and provide you with some related tips and precautions. 1. How to post pictures in Douyin comments? 1. Open Douyin: First, you need to open Douyin APP and log in to your account. 2. Find the comment area: When browsing or posting a short video, find the place where you want to comment and click the "Comment" button. 3. Enter your comment content: Enter your comment content in the comment area. 4. Choose to send a picture: In the interface for entering comment content, you will see a "picture" button or a "+" button, click

Xiaohongshu has rich content that everyone can view freely here, so that you can use this software to relieve boredom every day and help yourself. In the process of using this software, you will sometimes see various beautiful things. Many people want to save pictures, but the saved pictures have watermarks, which is very influential. Everyone wants to know how to save pictures without watermarks here. The editor provides you with a method for those in need. Everyone can understand and use it immediately! 1. Click the "..." in the upper right corner of the picture to copy the link 2. Open the WeChat applet 3. Search the sweet potato library in the WeChat applet 4. Enter the sweet potato library and confirm to get the link 5. Get the picture and save it to the mobile phone album

In PowerPoint, it is a common technique to display pictures one by one, which can be achieved by setting animation effects. This guide details the steps to implement this technique, including basic setup, image insertion, adding animation, and adjusting animation order and timing. Additionally, advanced settings and adjustments are provided, such as using triggers, adjusting animation speed and order, and previewing animation effects. By following these steps and tips, users can easily set up pictures to appear one after another in PowerPoint, thereby enhancing the visual impact of the presentation and grabbing the attention of the audience.

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

When using WPS office software, we found that not only one form is used, tables and pictures can be added to the text, pictures can also be added to the table, etc. These are all used together to make the content of the entire document look richer. , if you need to insert two pictures into the document and they need to be arranged side by side. Our next course can solve this problem: how to place two pictures side by side in a wps document. 1. First, you need to open the WPS software and find the picture you want to adjust. Left-click the picture and a menu bar will pop up, select "Page Layout". 2. Select "Tight wrapping" in text wrapping. 3. After all the pictures you need are confirmed to be set to "Tight text wrapping", you can drag the pictures to the appropriate position and click on the first picture.

1. Open the Douyin app, find the video you want to download and save, and click the [Share] button in the lower right corner. 2. In the pop-up window that appears, slide the function buttons in the second row to the right, find and click [Save Local]. 3. A new pop-up window will appear at this time, and the user can see the download progress of the video and wait for the download to complete. 4. After the download is completed, there will be a prompt of [Saved, please go to the album to view], so that the video just downloaded will be successfully saved to the user's mobile phone album.
