M
mike
Ok, I have a page that queries a database and retrieves values to
create a custom report in ms excel format on the fly so that it can be
downloaded. I can use the following sub to generate the report just
fine. It works correctly for every field in the database and creates
the report as desired except for one field and one field only. The
column type for this field is the text data type in MySQL. I chose
this type because, the field may be longer than 255 characters (this
field is used for comments). All my varchar, number and date columns
return values as expected. However with the text column, I get no
return (or "") for any query. In some cases I'm doing a "SELECT *
FROM " sort of query so I know that its not a problem with specifying
the column correctly in my query statement. It seems to have
something to do with datatype of this field and I would suspect that I
need to format it somehow but am unsure how to do so.
Thanks,
Mike
Sub CreateDownloadable()
'create the file to be downloaded to the user
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" &
Filename
Call OpenConnection
Dim MyRS
Set MyRS = adoConn.Execute(sqlStatement)
Dim i
For i = 0 to MyRS.Fields.count - 1
Response.Write myRS(i).name & vbTab
Next
Response.Write vbLf
If MyRS.EOF Then
Response.Write "No Records Were Found Matching the Search Criteria!"
End If
While Not MyRS.EOF
For i = 0 to MyRS.Fields.count - 1
If MyRS(i) = "" Then
Response.Write vbTab
Else
Response.Write MyRS(i) & vbTab
End If
Next
Response.Write vbLf
MyRS.MoveNext
Wend
MyRS.Close
Call CloseConnection()
End Sub
create a custom report in ms excel format on the fly so that it can be
downloaded. I can use the following sub to generate the report just
fine. It works correctly for every field in the database and creates
the report as desired except for one field and one field only. The
column type for this field is the text data type in MySQL. I chose
this type because, the field may be longer than 255 characters (this
field is used for comments). All my varchar, number and date columns
return values as expected. However with the text column, I get no
return (or "") for any query. In some cases I'm doing a "SELECT *
FROM " sort of query so I know that its not a problem with specifying
the column correctly in my query statement. It seems to have
something to do with datatype of this field and I would suspect that I
need to format it somehow but am unsure how to do so.
Thanks,
Mike
Sub CreateDownloadable()
'create the file to be downloaded to the user
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" &
Filename
Call OpenConnection
Dim MyRS
Set MyRS = adoConn.Execute(sqlStatement)
Dim i
For i = 0 to MyRS.Fields.count - 1
Response.Write myRS(i).name & vbTab
Next
Response.Write vbLf
If MyRS.EOF Then
Response.Write "No Records Were Found Matching the Search Criteria!"
End If
While Not MyRS.EOF
For i = 0 to MyRS.Fields.count - 1
If MyRS(i) = "" Then
Response.Write vbTab
Else
Response.Write MyRS(i) & vbTab
End If
Next
Response.Write vbLf
MyRS.MoveNext
Wend
MyRS.Close
Call CloseConnection()
End Sub