Re: how to update binary field types in ADO




<everymn@xxxxxxxxx> wrote in message
news:qsv9u2ptdf6hcfpjqhiftd2lhq1n1ukv1i@xxxxxxxxxx
Hi,

Having some difficulties updating binary fields. This bit of code
seems to work fine in VB6, but when I make the minor changes necessary
for it to run in VBscript the Update never happens.

In fact the assigment to fld.Value doesn't appear to happen since
msgbox fld.Value(0) after the assignment does nothing. Is this
something that is beyong the capabilities of VBscript?

Thank You!


Dim arrBin(7) As Byte
Dim b As Integer
Dim strBin As String
strBin = "bintest"

For b = 1 To 7
arrBin(b - 1) = Asc(Mid(strBin, b, 1))
Next

While Not oRs.EOF
For Each fld In oRs.Fields
lngtype = fld.Type
Select Case lngtype
Case adBinary, adVarBinary, adLongVarBinary
fld.Value = arrBin
oRs.Update
End Select
Next
oRs.MoveNext
Wend

You cannot type variables in VBScript, so the As keyword is invalid. The
problem is that VBScript cannot declare byte arrays. VBScript can read them,
but not create or modify them.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


.



Relevant Pages

  • Re: Another Access Scripting Question
    ... A wrinkle I often use when writing anything but the simplest VBScript is ... Dim App 'As Access.Application ... The database I built with all the queries works, ...
    (microsoft.public.access.modulesdaovba)
  • how to update binary field types in ADO
    ... something that is beyong the capabilities of VBscript? ... Dim arrBinAs Byte ... Dim strBin As String ... Select Case lngtype ...
    (microsoft.public.scripting.vbscript)
  • Re: Need WMI script
    ... How to handle the errors in vbscript. ... Dim strDomainName, strNodeText, strXmlBuilder ... However, if you use the cscript host, ... you can use a command similar to below at a command prompt: ...
    (microsoft.public.windows.server.scripting)
  • Re: Need WMI script
    ... Error handling in VBScript is obviously not as good as in .NET. ... normal error handling with "On Error GoTo 0". ... Dim adoCommand, adoConnection, strBase, strFilter, strAttributes, xmlDoc, ... you can use a command similar to below at a command ...
    (microsoft.public.windows.server.scripting)
  • Re: Another Access Scripting Question
    ... A wrinkle I often use when writing anything but the simplest VBScript is ... Dim App 'As Access.Application ... The problem SQL I am having is with an update query which is removing spaces ... The database I built with all the queries works, ...
    (microsoft.public.access.modulesdaovba)

Loading