Click to See Complete Forum and Search --> : inserting an image into sql server


johannesburgboy
06-24-2003, 07:36 AM
hi, is there a class with methods that i can use to insert images into the database?

i got some script from here:

http://www.stardeveloper.com/articles/display.html?article=2001033101&page=4

but i can't seem to get it to work properly.

please dave (or anyone) point me in the right direction.

thx

johannesburgboy
06-24-2003, 09:32 AM
yes, well there is an image data type.

anyway my problem however is inserting it from a browser.

i can upload a file, but i cant insert the data into a field.

also i am having trouble with my connection string:


Dim connStr
Set connStr = Server.CreateObject("ADODB.Connection")

connStr = "dsn=equity;User ID=eqviat;Password=equity;"

Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open "dentists", connStr, , , adCmdTable

then i get an error saying that the stored procedure "dentists" could not be found?

but i am trying to open a recordset of the table dentists

what the heck is wrong?

johannesburgboy
06-25-2003, 01:40 AM
thanks boytjie. i managed this: """" equity.articles replaces table dentists """""""

' VERY IMPORTANT LINE (this file is the connection/recordset
'constants file which i did not include:

<!--#include file="adovbs.inc"-->

Dim conn, rs
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

conn.Open "equity", "eqviat", "equity"
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic

rs.Open "equity.articles", conn, , ,adCmdTable

' Adding data
rs.AddNew
rs("id") = "1"
rs("image").AppendChunk fileData
rs.Update

rs.Close
Set rs = Nothing



although now i get another error about mulitple steps error - or something about it

thanks anyway dave