如何在vb-access 2003上添加图像,如何保存?如何检索? [英] how to add image on vb-access 2003,how to save?how to retrieve?

查看:61
本文介绍了如何在vb-access 2003上添加图像,如何保存?如何检索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是学生,我在vb.6中做一个示例项目并访问2003.i设计了一个表格,供学生输入,姓名和地址等,这些详细信息保存在数据库中并按我的选择进行检索。

但是我打算在我的''学生报名表'中插入学生pictrue。我不知道这个图片插入。请你帮助我,如何插入pictrue,如何存储在数据库中,如何在我的搜索命令上检索照片。



i还附上我的源代码,模块源代码和表格的屏幕截图。



你的忠实

boby kuriakose







- ---------------------------------来源代码登记表------------- --------------------

i am a student,i do one sample project in vb.6 and access 2003.i designed one form for students entry,name and address, etc,this details are saved in database and retrive in my choice.
but i have plan to insert student pictrue in my ''students entry form''.i have no idea about this picture insertation.can u please help me, how to insert pictrue,how to stored in database,how to retrive photo on my search command.

i also attached my source code,module source code and screen shot of form.

yours faithfully
boby kuriakose



----------------------------------SOURCE CODE ENTRY FORM---------------------------------

Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim i As Integer
Dim sngDailyRate As Single
Dim sngNumberOfDays As Integer
Dim sngHireCost As Single

Dim strLastName As String * 20
Dim strFirstName As String * 20
Dim s As String
Dim sql As String






Private Sub Form_Load()
sngDailyRate = 12.5
    sngNumberOfDays = 0
'    Days.Text = Format(sngNumberOfDays, "General Number")
    sngHireCost = 0
    strLastName = ""
    strFirstName = ""
    HireCost = Format(sngHireCost, "Currency")
Optname.Value = True
txtsrchname.Enabled = True
cmddelete.Enabled = False
--------------------MODULE SOURCE CODE------------

Option Explicit
Global cn As New Connection
Public Sub open_connection()
End Sub

Public Sub Main()
If cn.State Then cn.Close
cn.Open "microfox", "t", "a26yo1a01i0oo8Qr5ty51w521bipa"
frmSplash.Show
End Sub

推荐答案

我建​​议您不要将图像存储在数据库中,因为 MS Access规范和限制 [< a href =http://webcheatsheet.com/SQL/access_specification.phpt arget =_ blanktitle =新窗口> ^ ]。



I do not recommend you to store images in a database, because of MS Access specifications and limitations[^].

Quote:

Microsoft Access在表格中存储图像效率非常低。一个50 kb的jpg文件实际上可以在MDB中消耗1 Mb

Microsoft Access is very inefficient at storing images in tables. A 50 kb jpg file can actually consume 1 Mb in an MDB



来源: http://www.granite.ab.ca/access/imagehandling.htm [ ^ ]



我建议您将图像存储在数据库外部,例如在特定文件夹中。在MS Access数据库中,您应该只存储图像位置。



有关在MS Access数据库中存储图像的更多信息:

将图像存储在数据库中 [ ^ ]



如果您需要在MS Access数据库中存储图像,一些示例代码,您可以在这里找到: http://www.programmersheaven.com/mb/vba/314651/314651/saving-bmp-to- ole-field-in-microsoft-access / [ ^ ]。请记住,你自己承担风险!


source: http://www.granite.ab.ca/access/imagehandling.htm[^]

I would suggest you to store images outside the database, for example in a specific folder. In MS Access database you should store image location only.

More about storing images in MS Access database:
Store images in a database[^]

If you need to store images in MS Access database, some example code, you''ll find here: http://www.programmersheaven.com/mb/vba/314651/314651/saving-bmp-to-ole-field-in-microsoft-access/[^]. Remember, you''re doing it on your own risk!


这篇关于如何在vb-access 2003上添加图像,如何保存?如何检索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆