Saving a file to a sql db

  • I'm trying to save a crystal report (.rpt) file into my sql database but im not having much luck. I have the following code

    Set mstream = New ADODB.Stream

    mstream.Type = adTypeBinary

    mstream.Open

    rs.Open "Select Filecontents from Test", RetrieveDBConnection

    fname = lblFile.Caption

    mstream.LoadFromFile fname

    rs.Fields("Filecontents").Value = mstream.Read

    rs.Update

    i get the following error "Object or provider can't perform requested operation"

    What type does my field have to be in order for this to work. Is it even possible to save a .rpt to a database? Help is appreciated! Thanks

  • It's possible, no reason for it not to work. Use text or image for the column type, depending on whether it really is plain text through out or not.

    Andy

  • i'll give that a shot...thank you!

  • i changed it to both image and text and i still get the error "Object or provider is not capable of performing requested operation" My table consists of only one field called Filecontents that i want to use to store this file. I have ADO 2.5 referenced and i'm using a connection string to connect to the database. I also get the error when i tried to save a simple bmp file. Anyone help?

  • Are there any other ways this can be done? Thanks for the help

  • figured it out!

  • What ended up being your solution?

    Andy

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply