Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Posts
    7

    Unhappy Unanswered: ADO stream object

    I must save a file into a SQL Server table and read it back and save it somewhere.
    I have tried it in VB and it works; unfortunately I must use VFP :-(
    In VFP I can read the data from the table and save it to disk, but not read data from a file and saving it into a table.

    this works in VB:
    Set mStream = New ADODB.Stream
    mStream.Type = adTypeBinary
    mStream.Open
    mStream.LoadFromFile App.Path & "\" & sFileName
    rs.AddNew
    rs.Fields("descr").Value = sFileName
    rs.Fields("image1").Value = mStream.Read
    rs.Update

    this DOES NOT work in VFP:
    loStream = CreateObject("ADODB.Stream")
    loConnection.Open (lcConnStr)
    loRS.OPEN(lcSQL,loConnection,2,3)
    loStream.TYPE = 1
    loStream.Open
    loStream.LoadFromFile(lcfilename)
    loRS.AddNew
    loRS.Fields("descr").Value = lcfilename
    loRS.Fields("

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    This seems like a job for DTS - is there a reason why you are not using dts ?

  3. #3
    Join Date
    Oct 2002
    Posts
    7
    Sorry, someway some of my post was cut.

    up to this line it works:
    loRS.Fields("descr").Value = lcfilename

    The following line does not:
    loRecordSet.Fields("image1").value = loStream.read(-1)

    it says that it cannot find the ".value" property. without it, it generates an error "Function argument value, type or count is invalid"

    Is it that VFP cannot properly deal with the Variant data type that the Read Method returns, at least when it tries to insert it into an Image Field?
    About DTS, I must admit I have no clue how I can call it from my procedure! (especially from VFP.) Sounds like a good idea, though. Any help would be greatly appreciated. My current idea is to make a VB DLL that deals with the Stream Object, and call it from VFP.
    Thanks

    Fabrizio

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Which version of sql server are you using ? Do you have access to the sql server machine ? What permissions do you have ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •