Re: Does indexing on IMAGE fields work?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

I've tried your small function but how do you convert the string returned by
the funtion to an array to save it into an "image" field in db, cause i keep
getting error when i try to save the returned string.

/Sarmad


"Spicy Mikey" wrote:

I could have used this article a few days ago Hilary :)

I can confirm (from experience) that you are correct with your example.
Actually, Microsoft originally solved it with an algorithm using the ADODB
stream. However, I like to drop to the lowest common denominator when
possible to avoid depending on outside processes.

Once understanding the problem, we can accomplish the same thing in VB with
this simple procedure (although it is admitedly a bit slower). Oddly enough,
this works with binary data too (i.e. rich text with embedded images)
eventhough you're pushing it through a string variable. VB strings are
simply specialized byte array's. It looks wrong but it works.

Public Function ArrayToString(ByRef ary_btData() As Byte) As String
Dim I As Double
For I = LBound(ary_btData) To UBound(ary_btData)
ArrayToString = ArrayToString & Chr(ary_btData(I))
Next
End Function

FYI: This was the solution MS gave me using ADODB stream. Like I said, it
works perfectly and is also slightly faster. The only drawback is you're
dependent on someone elses code in a black box.
Dim mstream As ADODB.Stream
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.Write imp_btArray()
mstream.Position = 0
mstream.Type = adTypeText
mstream.Charset = "us-ascii"
GetStream = mstream.ReadText

Hope this thread will help someone avoid this pitfall. Thanks again for the
help
--
Maz


"Hilary Cotter" wrote:

I actually knew about this.

http://www.indexserverfaq.com/SQLLoadADO.htm

Towards the bottom I discuss it.

--
Hilary Cotter

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



"ML" <ML@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9C38B7BE-B134-499D-AA9D-834B874C781C@xxxxxxxxxxxxxxxx
Thank you for that explanation.


ML

---
http://milambda.blogspot.com/



.


Quantcast