Page 2 of 2 FirstFirst 12
Results 41 to 61 of 61

Thread: This may interest some of you!! Storing any File type in a database!

  1. #41

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    At a quick glance i note:

    On the delete statement:

    1) sql = "DELETE FileInfo.[Comments] FROM FileInfo WHERE FileInfo.[FileName] = '" & selectedFile & "'"

    2) Else just do this rst.fields("Comments") = ""

    On the Update statement:

    1) sql = "UPDATE FileInfo SET Comments = " & "rst.Fields("Comments").AppendChunk strdata " & "WHERE FileInfo.FileName =" & selectedFile

    Just those "" could help!

    Good luck!
    b

  2. #42
    Member
    Join Date
    Mar 2002
    Posts
    35
    Hi Beacon,

    Thank you very much for your help!! with rst.fields("Comments") = "" works!

    I did it this way:

    strdata = ""
    rst.Fields("Comments") = ""
    rst.Update

    strdata = txtComments.Text
    rst.Fields("Comments").AppendChunk strdata
    rst.Update

    i added these codes before the first strdata:

    Set rst = New ADODB.Recordset
    sql = "SELECT FileInfo.[Comments] FROM FileInfo WHERE FileInfo.FileName = " & selectedFile
    Set rst = cnn.Execute(sql)

    and i got this error: "Too few parameters. Expected 1"
    What does it mean? I get this error for many other sql SELECT statements and i had to use this kind of code (rst.Open "UserInfo", cnn, adOpenKeyset, adLockPessimistic, adCmdTable) to do the work.

    Why does this happen?

  3. #43

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    it means that the rst expects other parameters.

    First i'd say open your recordset up then execute your sql query!

    i.e
    VB Code:
    1. Set rst = New ADODB.Recordset
    2. sql = "SELECT FileInfo.[Comments] FROM FileInfo WHERE FileInfo.FileName = " & selectedFile
    3. rst.Open "UserInfo", cnn, adOpenKeyset, adLockPessimistic, adCmdText
    4. Set rst = cnn.Execute(sql)

  4. #44
    Member
    Join Date
    Mar 2002
    Posts
    35
    hhmm, i'm still getting the same error when i do this:

    rst.Open "FileInfo", cnn, adOpenKeyset, adLockPessimistic, adCmdTable

    i don't understand the difference between using adCmdText and adCmdTable.

  5. #45

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    adcmdText allows you use sql statements in your recordset!

    Have you set rst = new.adodb.recordset??

    Try this:
    VB Code:
    1. Set rst = New ADODB.Recordset
    2. rst.Open "SELECT FileInfo.[Comments] FROM FileInfo WHERE FileInfo.FileName = " & selectedFile, cnn, adOpenKeyset, adLockPessimistic, adCmdText

    Does that work??

    I dont think it likes this:
    Set rst = cnn.Execute(sql)

    perhaps just cnn.Execute(sql) or rst = cnn.Execute(sql)

  6. #46
    Member
    Join Date
    Mar 2002
    Posts
    35
    I'm still getting the same error at rst.Open statement

  7. #47

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    re-post your rst.open statement and the error now!!

  8. #48
    Member
    Join Date
    Mar 2002
    Posts
    35
    ok, here it goes......

    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset

    rst.Open "SELECT FileInfo.[Comments] FROM FileInfo WHERE FileInfo.FileName = " & selectedFile, cnn, adOpenKeyset, adLockPessimistic, adCmdText

    Error: "Too few parameters. Expected 1"


    Sorry for disturbing you, Beacon.

    Thank you for patiently helping me.

  9. #49

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    ahh how'd i miss that!! Trying to do 10 things!

    your sql statement is wrong

    rst.Open "SELECT FileInfo.[Comments] FROM FileInfo WHERE FileInfo.FileName = '" & selectedFile & "';", cnn, adOpenKeyset, adLockPessimistic, adCmdText

    Try that!
    later
    b

  10. #50
    Member
    Join Date
    Mar 2002
    Posts
    35
    Thank you Beacon!!!!!!!!!!!!!!!!!!!!!!
    Thank you very much for your help!!

  11. #51
    Lively Member
    Join Date
    Jul 2002
    Location
    Gateshead, UK
    Posts
    101

    lol

    Hey that was so simple, I was dying to help you out there! Jeez...

    But, he's already helped you out superbly well (and this post is quite later on, in respect to this thread date...); so I'll leave ya...
    <% Session("OwNeD")=True %><html><body>Blah... <%="Now get your ass back to the twilight zone..."%></body></html>

  12. #52
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    Streaming...

    Hey Beacon,
    I was wondering if you ever got around to trying the streaming thing... Not being pushy... I'm just wondering...

    squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  13. #53
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    This looks like the holy grail from where I'm working. I take it it would work for saveing *.doc files to use as file fragments for "slapping" in to blank word files when it comes time for access to create doffing complex word files as an output...?

    Is there anything I would need to know, alter, bare in mind while doing this?

    ?
    'What's this bit for anyway?
    For Jono

  14. #54
    New Member
    Join Date
    Oct 2004
    Posts
    2

    thank you

    thank you very much for your information. I am like a baby when it comes to the web or anythng in it. you made things much more easier for me to understand. The emocons? i dont know what they are but i got some clothes with the same logo on it. cool i guess. thanks again

  15. #55
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    This is inefficient code.

    Why not store the hyperlink in the database and have the image or file on a network resource ?

  16. #56
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    Well that's just a matter of opinion...

    What if you don't want the user to have any access to the picture or file except through your program?

    BTW... Try to keep posts a little more constructive and don't bash other peoples code.. I'm sure Beacon worked a while on this stuff and I've used it personally.. it's really good and works great...

    This is an OLD, VERY OLD thread anyways man...

    Good Job again Beacon!

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  17. #57
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    Originally posted by squirrelly1
    Well that's just a matter of opinion...

    What if you don't want the user to have any access to the picture or file except through your program?

    BTW... Try to keep posts a little more constructive and don't bash other peoples code.. I'm sure Beacon worked a while on this stuff and I've used it personally.. it's really good and works great...

    This is an OLD, VERY OLD thread anyways man...

    Good Job again Beacon!

    Squirrelly1

    Whose bashing ? Why do programmers not like constructive criticism? Reminds me of the old vb6 wimps who cried when I said code was bad. Good programmers look for efficient methods, coding practices, and styles. No one is bashing, its bad code and it is very inefficient.

    Why would you want to show the resource or file from within one app but not another, that makes NO sense.

    Doens't matter how old the thread is, I responded to it .

  18. #58
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    What if the file I had stored in the database was confidential or my personal creation and I didn't want someone to have access to it unless they have permission???

    To tell someone that their code is inefficient and offer no relative solution is not exactly constructive there bud... Why not just start up your own thread on your method for what you want to do?

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  19. #59
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    Originally posted by squirrelly1
    What if the file I had stored in the database was confidential or my personal creation and I didn't want someone to have access to it unless they have permission???

    To tell someone that their code is inefficient and offer no relative solution is not exactly constructive there bud... Why not just start up your own thread on your method for what you want to do?

    Squirrelly1
    Even if it was confidential, you can impose these security entities directly on the resource, in addition read, write, execute.

    I

  20. #60
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492
    Originally posted by squirrelly1
    What if the file I had stored in the database was confidential or my personal creation and I didn't want someone to have access to it unless they have permission???

    To tell someone that their code is inefficient and offer no relative solution is not exactly constructive there bud... Why not just start up your own thread on your method for what you want to do?

    Squirrelly1
    Even if it was confidential, you can impose these security entities directly on the resource, in addition read, write, execute.

    I did offer a solution. Hyperlinks.

  21. #61
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    Well, to each his own I guess... I personally like the code and the idea, but hey... that's probably just me being paranoid that some freak is gonna try and hack the system and take whatever they want (*looks around anxiously*)...

    I also think it's pretty neet just to have your software and a database and that's it... not a bunch of pictures, pdf's, whatever...

    But like I said, to each his own.

    Good luck to all,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

Page 2 of 2 FirstFirst 12

Posting Permissions

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



Click Here to Expand Forum to Full Width