faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Database Backed Sites

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

102 of 123 people (83%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I get the value of a large TEXT or MEMO field using GetChunk?

Jul 19th, 2000 18:24
Chris Durkin,


Working with MS Access MEMO fields or SQL Server TEXT fields is very 
error prone in ADO/ASP. Often the data will be truncated if you use the 
default syntax:
  stringvar = recordset.fields("longtext").value
The first thing to remember is always put the long text field last in 
your SQL statement. There is a bug somewhere (ADO or SQL Server) which 
causes data to be truncated otherwise.
Second, the most efficient way to process large amounts of string or 
binary data in ADO/ASP is to use the GetChunk method of the Field 
object. Here is an example:
  set rst = conn.execute("select job_title, job_descr from jobs")
  strTitle = rst.Fields("job_title").value & ""
  vChunk = rst.Fields("job_descr").GetChunk(4000)
  strDescr = vChunk
  Do Until IsNull(vChunk) = true
    vChunk = rst.Fields("job_descr").GetChunk(4000)
    vDescr = vDescr & vChunk
  Loop
  response.write "Job Title: " & strTitle & "<br>"
  response.write "Description: " & strDescr



© 1999-2004 Synop Pty Ltd