VB加载图片

时间:2017-11-18 14:36:10
【文件属性】:

文件名称:VB加载图片

文件大小:57KB

文件格式:DOC

更新时间:2017-11-18 14:36:10

VB PICTURE

对图片用VB进行加载到数据库中 从数据库中读图片 Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim mstream As ADODB.Stream szConString = "Provider=sqloledb.1;Persist Security Info=False;User ID=sa;Initial Catalog=db;Data Source=(local);Password=soft " Set cn = New ADODB.Connection cn.CursorLocation = adUseClient cn.Open szConString Set rs = New ADODB.Recordset szSql = "Select * from photo_info " _ & " where photo_id='" & PhotoId & "'" rs.Open szSql, cn, adOpenKeyset, adLockOptimistic Set mstream = New ADODB.Stream mstream.Type = adTypeBinary mstream.Open mstream.Write rs.Fields("vehicle_photo").Value szVehiclePhotoName = rs.Fields("vehicle_photo_name").Value mstream.SaveToFile App.Path & "\"&szVehiclePhotoName,adSaveCreateOverWrite Picture1.Picture = LoadPicture(App.Path & "\" & szVehiclePhotoName


网友评论