ADO recordset into memory but want direct to file...?




Is there a way using ADO to execute a SQL statement that instead of returning the recordset into a memory object that I can return it writing directly to a file object

Currently, I am getting the record set and then writing it to file but during some testing I realized that when the record set is really large it consumes all of the machines memory and it's virtual memory as well before getting the chance to write to file (it is only 256megs for each but still).

I am using ASP pages to call functions in a DLL developed in VB.

Thanx

JB
Posted On: Monday 22nd of October 2012 06:26:48 AM Total Views:  388
View Complete with Replies

RELATED TOPICS OF ASP PROGRAMMING LANGUAGE




Shadow upload error using request form, binary data message - Page 2

cheers, glad I could help. there are already references to general help and to help insert into database, no point in adding another link. the part with use objUpload("name") intead of Request.Form("name") is explained in the main post.
VIEWS ON THIS POST

282

Posted on:

Friday 26th October 2012
View Replies!

ShadowUploader - resize the uploaded images on the fly

(regarding this thread: http://forums.aspfree.com/code-bank-...res-94647.html) Originally Posted by Shadow Wizard nope, classic ASP has its limits, that's one of them... you'll have to install and use some 3rd party component for this, or better yet - switch to ASP.NET where it's possible using simple code. Could you please tell me where can I find the script (in asp.net) which can re-size the image height and width
VIEWS ON THIS POST

395

Posted on:

Friday 26th October 2012
View Replies!

ShadowUploader problem - Page 2

Originally Posted by Shadow Wizard sure, that actually was my problem, thanks for helping me solve it! im using shodowuploader.asp and im getting this error Code: Microsoft VBScript runtime error '800a004c' Path not found /Aj Test/Invoice Generator/ShadowUploader.asp, line 263 This is line 264 Code: Set objFile = objFSO.CreateTextFile(strPath) Ive changed this to: Code: ' Public Property Let FileName(strName) ' m_fileName = strName ' End Property Public Property Let FileName(strName) Dim arrTemp arrTemp = Split(strName, "/") m_fileName = arrTemp(UBound(arrTemp)) End Property
VIEWS ON THIS POST

261

Posted on:

Friday 26th October 2012
View Replies!

Problems with Shadow wizards upload script

I'm having some troble with the script which I'm trying to use, It was recomended to me as im trying to upload an image to the server. When the page with the sample code snipt given is opened I get the folowing error: Microsoft VBScript compilation error '800a03ea' Syntax error /cms_test/ShadowUploader.asp, line 8 Class ShadowUpload ^ This was the thread I got the code from: http://forums.aspfree.com/code-bank-...res-94647.html Many
VIEWS ON THIS POST

261

Posted on:

Friday 26th October 2012
View Replies!

Problem with ShadowUploader

Hi. I have a slight problem with ShadowUploader. I am using a script clsUpload for uploading my file. That script doesn't have Image dimension property in it. Thats why I am using ShadowUploader just to check whether the file uploaded is image or not and to limit the dimensions of the image. The code is working fine but it is messing with the other script. Following is the code. Code: Dim InvalidSize InvalidSize = True if Request.ServerVariables("REQUEST_METHOD") = "POST" then Set j = new ShadowUpload Response.write (j.File(txtFile).ImageWidth) Set j = Nothing Set o = new clsUpload If o.Exists("cmdSubmit") Then strCAPTCHA = Trim(o.Valueof("strCAPTCHA")) End If if CheckCAPTCHA(strCAPTCHA) = False then errMSG="Wrong Verification code entered" End If if errMSG="" Then Place1 = o.Valueof("place") if (Place1="1") Then if (o.lengthof("txtFile") = asFieldName And asFieldName > -1 Then Set Field = oFields(asFieldName) Else Set Field = New clsField End If Else For lnIndex = 0 To lnLength If LCase(oFields(lnIndex).FieldName) = LCase(asFieldName) Then Set Field = oFields(lnIndex) Exit Property End If Next Set Field = New clsField End If End Property ' ------------------------------------------------------------------------------ Public Function Exists(ByRef avKeyIndex) Exists = Not IndexOf(avKeyIndex) = -1 End Function ' ------------------------------------------------------------------------------ Public Property Get ValueOf(ByRef avKeyIndex) Dim lnIndex lnIndex = IndexOf(avKeyIndex) if lnIndex = -1 Then Exit Property ValueOf = oFields(lnIndex).Value End Property ' ------------------------------------------------------------------------------ Public Property Get FileNameOf(ByRef avKeyIndex) Dim lnIndex lnIndex = IndexOf(avKeyIndex) if lnIndex = -1 Then Exit Property FileNameOf = oFields(lnIndex).FileName End Property ' ------------------------------------------------------------------------------ Public Property Get LengthOf(ByRef avKeyIndex) Dim lnIndex lnIndex = IndexOf(avKeyIndex) if lnIndex = -1 Then Exit Property LengthOf = oFields(lnIndex).Length End Property ' ------------------------------------------------------------------------------ Public Property Get BinaryDataOf(ByRef avKeyIndex) Dim lnIndex lnIndex = IndexOf(avKeyIndex) if lnIndex = -1 Then Exit Property BinaryDataOf = oFields(lnIndex).BinaryData End Property ' ------------------------------------------------------------------------------ Private Function IndexOf(ByVal avKeyIndex) Dim lnIndex If avKeyIndex = "" Then IndexOf = -1 ElseIf IsNumeric(avKeyIndex) Then avKeyIndex = CLng(avKeyIndex) If nFieldCount > avKeyIndex And avKeyIndex > -1 Then IndexOf = avKeyIndex Else IndexOf = -1 End If Else For lnIndex = 0 To nFieldCount - 1 If LCase(oFields(lnIndex).FieldName) = LCase(avKeyIndex) Then IndexOf = lnIndex Exit Function End If Next IndexOf = -1 End If End Function ' ------------------------------------------------------------------------------ Public Property Let FileFullPath(sValue) psFileFullPath = sValue End Property '___________________________________________________________________________________ Public Property Get FileFullPath() FileFullPath = psFileFullPath End Property ' ------------------------------------------------------------------------------ Public Property Let FileInputName(sValue) psFileInputName = sValue End Property ' -------------------- ---------------------------------------------------------- Public Function Save() if psFileFullPath "" and psFileInputName "" then 'Save to connectionless client side recordset, write to stream, 'and persist stream. 'would think you should be able to write directly to 'stream without recordset, but I could not get that to work On error resume next binData = o.BinaryDataOf(psFileInputName) set rs = server.createobject("ADODB.RECORDSET") rs.fields.append "FileName", 205, LenB(binData) rs.open rs.addnew rs.fields(0).AppendChunk binData if err.number = 0 then set objStream = Server.CreateObject("ADODB.Stream") objStream.Type = 1 objStream.Open objStream.Write rs.fields("FileName").value objStream.SaveToFile psFileFullPath, 2 objStream.close set objStream = Nothing ENd if rs.close set rs = nothing psError = Err.Description else psError = "One or more required properties (FileFullPath and/or FileInputName) not set" End If End Function Public Property Get Error() Error = psError End Property ' ------------------------------------------------------------------------------ Public Property Get ContentTypeOf(ByRef avKeyIndex) Dim lnIndex lnIndex = IndexOf(avKeyIndex) if lnIndex = -1 Then Exit Property ContentTypeOf = oFields(lnIndex).ContentType End Property ' ------------------------------------------------------------------------------ Private Sub Class_Terminate() Dim lnIndex For lnIndex = 0 To nFieldCount - 1 Set oFields(0) = Nothing Next End Sub ' ------------------------------------------------------------------------------ Private Sub Class_Initialize() Dim lnBytes ' Bytes received from the client Dim lnByteCount ' Number of bytes received Dim lnStartPosition ' Position at which content begins Dim lnEndPosition ' Position at which content ends Dim loDic ' Contains properties of each ' specific field ' Local dictionary object(s) ' to be appended to class-scope ' dictioary object. Dim lnBoundaryBytes ' Bytes contained within the current boundary Dim lnBoundaryStart ' Position at wich the current boundary begins ' within the lnBytes binary data. Dim lnBoundaryEnd ' Position at wich the current boundary ends ' within the lnBytes binary data. Dim lnDispositionPosition Dim lsFieldName ' Name of the current field being parsed from ' Binary Data Dim lsFileName ' Name of the file within the current boundary Dim lnFileNamePosition ' Location of file name within current boundary Dim loField ' clsField Object Dim lsValue ' Value of the current field Dim lsContentType ' ContentType of the binary file (MIME Type) ' Initialize Fields nFieldCount = 0 ReDim oFields(-1) ' Read the bytes (binary data) into memory lnByteCount = Request.TotalBytes lnBytes = Request.BinaryRead(lnByteCount) 'Get the lnBoundaryBytes lnStartPosition = 1 lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB(vbCr)) If lnEndPosition >= lnStartPosition Then lnBoundaryBytes = MidB(lnBytes, lnStartPosition, lnEndPosition - lnStartPosition) End If lnBoundaryStart = InstrB(1, lnBytes, lnBoundaryBytes) ' Loop until the BoundaryBytes begin with "--" Do Until (lnBoundaryStart = InstrB(lnBytes, lnBoundaryBytes & CStrB("--"))) ' data within this boundary is stored within a local dictionary ' to be appended to the class-scope dictionary. ReDim Preserve oFields(nFieldCount) nFieldCount = nFieldCount + 1 Set loField = New clsField lnDispositionPosition = InstrB(lnBoundaryStart, lnBytes, CStrB("Content-Disposition")) ' Get an object name lnStartPosition = InstrB(lnDispositionPosition, lnBytes, CStrB("name=")) + 6 lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB("""")) lsFieldName = CStrU(MidB(lnBytes, lnStartPosition, lnEndPosition - lnStartPosition)) loField.FieldName = lsFieldName ' Get the location fo the file name. lnFileNamePosition = InstrB(lnBoundaryStart, lnBytes, CStrB("filename=")) lnBoundaryEnd = InstrB(lnEndPosition, lnBytes, lnBoundaryBytes) 'Test if object is a file If Not lnFileNamePosition = 0 And lnFileNamePosition < lnBoundaryEnd Then ' Parse Filename lnStartPosition = lnFileNamePosition + 10 lnEndPosition = InstrB(lnStartPosition, lnBytes, CStrB("""")) lsFileName = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition)) loField.FileName = lsFileName ' Parse Content-Type lnStartPosition = InstrB(lnEndPosition,lnBytes,CStrB("Content-Type:")) + 14 lnEndPosition = InstrB(lnStartPosition,lnBytes,CStrB(vbCr)) lsContentType = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition)) loField.ContentType = lsContentType ' Parse Content lnStartPosition = lnEndPosition + 4 lnEndPosition = InstrB(lnStartPosition,lnBytes,lnBoundaryBytes)-2 lsValue = MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition) loField.BinaryData = lsValue & CStrB(vbNull) loField.Length = LenB(lsValue) Else ' Parse Content lnStartPosition = InstrB(lnDispositionPosition, lnBytes, CStrB(vbCr)) + 4 lnEndPosition = InstrB(lnStartPosition, lnBytes, lnBoundaryBytes) - 2 lsValue = CStrU(MidB(lnBytes,lnStartPosition,lnEndPosition-lnStartPosition)) loField.Value = lsValue loField.Length = Len(lsValue) End If Set oFields(UBound(oFields)) = loField 'Loop to next object lnBoundaryStart = InstrB(lnBoundaryStart + LenB(lnBoundaryBytes), lnBytes, lnBoundaryBytes) Set loField = Nothing Loop End Sub ' ------------------------------------------------------------------------------ Private Function CStrU(ByRef psByteString) Dim lnLength Dim lnPosition lnLength = LenB(psByteString) For lnPosition = 1 To lnLength CStrU = CStrU & Chr(AscB(MidB(psByteString, lnPosition, 1))) Next End Function ' ------------------------------------------------------------------------------ Private Function CStrB(ByRef psUnicodeString) Dim lnLength Dim lnPosition lnLength = Len(psUnicodeString) For lnPosition = 1 To lnLength CStrB = CStrB & ChrB(AscB(Mid(psUnicodeString, lnPosition, 1))) Next End Function ' ------------------------------------------------------------------------------ End Class ' ------------------------------------------------------------------------------ %> CB
VIEWS ON THIS POST

246

Posted on:

Friday 26th October 2012
View Replies!

ShadowUploader - help needed

i have an error while in live url, eventhough the script alreadry success in my pc. this the error: Disallowed_Path_Characters and my path are : ../images/
VIEWS ON THIS POST

483

Posted on:

Friday 26th October 2012
View Replies!

ShadowUploader - integrating the upload with existing code - Page 2

Originally Posted by bubble can you give me a sample code which form page and script page using the diffrent pages thx That question makes zero sense and has nothing to do with your previous post. You said it errors... what is the problem
VIEWS ON THIS POST

325

Posted on:

Friday 26th October 2012
View Replies!

Upload pdfs shadow script

I am uploading 12 pdfs using shadow upload script here is my code Code: Set objUpload=New ShadowUpload If objUpload.GetError"" Then Response.Write("Sorry, could not upload: "&objUpload.GetError) Else For x=0 To objUpload.FileCount-1 Call objUpload.File(x).SaveToDisk("F:\Inetpub\WWWRoot\pdfs\", "") Next End If How do i get the names of the pdfs there will not always be 12 pdfs sometimes there will be 2 sometimes 5 any idea
VIEWS ON THIS POST

425

Posted on:

Friday 26th October 2012
View Replies!

Shadow uploader ??

i'm having a problem with end users submitting more then one photo for there number, the problem is it doesn't rename the second file. it only renames the first file they upload. is there a way to have the second file renamed 71b.jpg or something like that. instead of just uploading it with out renaming it
VIEWS ON THIS POST

328

Posted on:

Friday 26th October 2012
View Replies!

ShadowUploader - integrating the upload with existing code - Page 3

Originally Posted by bubble now i trying to use your code for upload and save to database, this is the code strSQL = "INSERT INTO foto (userid, ft_dir, comment) VALUES ('somedata', '" & objUpload.File(x).FileName & "','" & objUpload("name") & "')" objConn.Execute(strSQL) /ciayoo/ShadowUploader.asp, line 283 That does not help us. What is the error being generated What line is it being generated on Simple, simple things to provide if you are looking for help.
VIEWS ON THIS POST

313

Posted on:

Friday 26th October 2012
View Replies!

Questions regarding correct approaches to adopt.

Hi This is a question about how to approach a particular task. I have a basic management system setup, where the user can add new pages, edit and delete. Most of the pages follow the same style. Pages are differenciated by a page id = PID But lets say I have a management page. This page differs in style to the standard pages. In the management system I would most likely have a seperate area to control management. I.e allow the client to add photo and text for the management section. But because this is a seperate management area how can I relate that to a page. My first approach would have been to put the Recordset into the index file and if the pid matches the management id then show the data. My concern is that lets just say that the client deletes management, then that kind of screws things up does it not. It would need this to be flexible rather than hardcoding the id. How would anyone else go about this, as some pages are different and will require additional elements to be controlled via the system. Any advice links would help me approach this in the correct way.
VIEWS ON THIS POST

275

Posted on:

Friday 26th October 2012
View Replies!

SPLIT FROM: Shadow Uploader - Email the uploaded file

im try to create a simple send mail via ASP. here is the code
VIEWS ON THIS POST

262

Posted on:

Friday 26th October 2012
View Replies!

Make a textarea readonly

I have a text area which pulls data from the text file. How can I make this data readonly so that the users cannot delete any information in their browser, but they can still scroll the textarea to see the list. Is there any property of textarea which can make the contents readonly.
VIEWS ON THIS POST

352

Posted on:

Friday 26th October 2012
View Replies!

ShadowUploader - Server.CreateObject Access Error when creating Scripting.Dictionary

(regarding this thread: http://forums.aspfree.com/code-bank-...res-94647.html) Shadow Wizard - would you be able to do this without using Scripting.Dictionary Trying to create it causes a problem on my school's server - the sysadmin found an article on the MSKB, but doesn't seem to have fixed it, and it's half-term now...
VIEWS ON THIS POST

574

Posted on:

Friday 26th October 2012
View Replies!

Set readonly value based on access level

I need to know how to disable a button based on the username that logs onto the web application.
VIEWS ON THIS POST

256

Posted on:

Friday 26th October 2012
View Replies!

Error when using shadow uploader

I have a login page where user enters his username password i verify if he is a valid user or not if he is i redirect him to a diff page and in querystring i transfer 3 variables ok I get the 3 variables on that page then i have 3 radio buttons when user selects one of them i display the company name and they upload the file and some stas for the company the client requirement is when the user submits the form it should be done by radio button not a submit button for uploading of file i have used shadow's code here is my problem if the user doesnt upload a file it gives me an error saying Microsoft VBScript runtime error '800a01a8' Object required: 'm_Request' /ERP/onlineerp/ShadowUploader.asp, line 27 here is the code for it [CODE] Company Details Country U.S.A Canada International Company name Stats Upload File /> now i have the code for submitcompany.asp Code:
VIEWS ON THIS POST

420

Posted on:

Friday 26th October 2012
View Replies!

Upload error using ShadowUploader

I'm useing ShadowUploader to upload 2 files. It works fine when I upload two images at once, or when I upload a first file and not a second. However, when I try to upload a second and not a first I get the following error Error Type: Microsoft VBScript runtime (0x800A0009) Subscript out of range: 'index' /sheep/ShadowUploader.asp, line 24 I understand what this error means, but my conditionals should be protecting for this. I'm stumped My code Code: set uploader=New ShadowUpload if uploader("uploadPicture")"" then Call uploader.File(0).SaveToDisk(Server.MapPath("images"), "") end if if uploader("uploadFile")"" then Call uploader.File(1).SaveToDisk(Server.MapPath("files"), "") end if ... other stuff ... if uploader("uploadPicture")="" then add.Fields("PictureName") = "noImage.jpg" else add.Fields("PictureName") = uploader.File(0).FileName end if if uploader("uploadFile")"" then add.Fields("FileName") = uploader.File(1).FileName end if
VIEWS ON THIS POST

263

Posted on:

Friday 26th October 2012
View Replies!

problem

I keep getting an error saying that it con't find this file. I've copied it in the root directory, but nothing. I have included at the very top of the page (outside the ) AND If I put it inside I get the usual error: - Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
VIEWS ON THIS POST

475

Posted on:

Friday 26th October 2012
View Replies!

Shadow Uploader - preventing user from uploading non image files

(regarding this thread: http://forums.aspfree.com/code-bank-...res-94647.html) Originally Posted by Shadow Wizard this will not save non-image files. as for extension, I fear I didn't understand what you mean - you try to save the file with different extension\t I disagree. I was able to upload an Excel Spreadsheet with no trouble at all.
VIEWS ON THIS POST

664

Posted on:

Friday 26th October 2012
View Replies!

How to set readonly property of ASP.net textbox using Javascript

I have a standard ASP Textbox control on my form and need to set the readonly property of it using javascript. It's not essential that I do it via client side script but would look a lot better.
VIEWS ON THIS POST

225

Posted on:

Friday 26th October 2012
View Replies!