ImageScan ActiveX
SQL
from
message
itsmeclay
mag 23, 2008
time 01.20
COULD YOU PLEASE PROVIDE ONE SAMPLE OF CODE TO USE SQL STATMENT TEXT1.TEXT=IMAGE2 TO A RECORD SET THAT ONLY CONTIANS IMAGE2 THANK YOU
esupport
mag 28, 2008
time 15.35
you can use the FileStream object and a byte array to read and to write BLOB data from Microsoft SQL Server to a file, and if you want to save the image directly, without the use of files, convert the image into an array of bytes. ' *** WRITE Dim con As New SqlConnection(Server=YourServer;uid=
;pwd=
;database=northwind) Dim da As New SqlDataAdapter(* From MyImages, con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() da.MissingSchemaAction = MissingSchemaAction.AddWithKey Dim fs As New FileStream(C:\winnt\Gone Fishing.BMP, FileMode.OpenOrCreate,FileAccess.Read) Dim MyData(fs.Length) As Byte fs.Read(MyData, 0, fs.Length) fs.Close() con.Open() da.Fill(ds, MyImages) Dim myRow As DataRow myRow = ds.Tables(MyImages).NewRow() myRow(Description) = This would be description text myRow(imgField) = MyData ds.Tables(MyImages).Rows.Add(myRow) da.Update(ds, MyImages) fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing ' *** READ Dim con As New SqlConnection(Server=YourServer;uid=
;pwd=
;database=northwind) Dim da As New SqlDataAdapter(* From MyImages, con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() con.Open() da.Fill(ds, MyImages) Dim myRow As DataRow myRow = ds.Tables(MyImages).Rows(0) Dim MyData() As Byte MyData = myRow(imgField) Dim K As Long K = UBound(MyData) Dim fs As New FileStream(C:\winnt\Gone Fishing2.BMP, FileMode.OpenOrCreate, FileAccess.Write) fs.Write(MyData, 0, K) fs.Close() fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing
Login
Home
Hardware
Software
Download
Store
Forums
Archive
Customer
Reseller
©2004 (CSI) Centro Studi Informatica di Danilo Priore. All rights reserved.