
April 13th, 2000, 05:47 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
AppendChunk Giving error
<i><b>Originally posted by : Shawn (shawn@speaketh.com)</b></i><br />Hi, I have previously posted a question about appendchunk error. I have check that the SNA server and the MDAC component are all of the latest version. Why is it that the script still give this error: ADODB.Field error '800a0c93' <br />Operation is not allowed in this context. <br />I have a page to upload a file to the server. With 3 fields, url, category, blob(the uploaded file). The file is uploaded to the server but the script keep giving error message and the database is not updated.<br /><br />Below is the code for the script.<br /><br /><br />Response.Expires=0<br />Response.Buffer = TRUE<br />Response.Clear<br />byteCount = Request.TotalBytes<br /><br />RequestBin = Request.BinaryRead(byteCount)<br />Dim UploadRequest<br />Set UploadRequest = CreateObject("Scripting.Dictionary")<br /><br />BuildUploadRequest RequestBin<br /><br /><br />url = UploadRequest.Item("url").Item("Value")<br />category = UploadRequest.Item("category").Item("Value")<br />graphic = UploadRequest.Item("blob").Item("Value")<br /><br /><br />contentType = UploadRequest.Item("blob").Item("ContentType")<br />filepathname = UploadRequest.Item("blob").Item("FileName")<br />filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"""))<br />value = UploadRequest.Item("blob").Item("Value")<br /><br />'Create FileSytemObject Component<br /> Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")<br /><br />'Create and Write to a File<br /> pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14<br /> Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Re quest.ServerVariables("PATH_INFO")),pathEnd)&filename)<br /> MyFile.Write getString(value)<br /> MyFile.Close<br /><br /> <br /><br />Set conn = Server.CreateObject("ADODB.Connection")<br />conn.open "DSN=Classicpost"<br /><br /><br />sql = "SELECT * FROM Advertisement"<br />Set rs = Server.CreateObject("ADODB.Recordset")<br />rs.Open sql, conn, 3, 3<br /><br />rs.AddNew<br />rs.Fields("url") = url<br />rs.Fields("category") = category<br /><br />picturechunk = graphic & chrB(0)<br />rs.Fields("graphic").AppendChunk picturechunk<br /><br /><br />rs.Update<br />conn.close<br />
|