Reading csv file in classic asp. Problem: column values are truncated up to 300 characters

前端 未结 1 1225
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 09:19

I have a page that can upload csv files and saved to table in the database. I\'m using below connection string to read a csv file.

set connection = Server.Create         


        
相关标签:
1条回答
  • 2021-01-23 10:04

    I think the issue may be to do with automatic datatype settings, jet will sample the rows in the csv and create a recordset to fit.. if the rows it samples are < 300 chars it wont give you enough room.

    I think there is a registry key you can change to make it analyse more rows, this link is talking about excel but i think its related:

    http://support.microsoft.com/kb/281517

    could be wrong.. its not something I have actually ever experienced myself.

    from the article:

    "The valid range of values for the TypeGuessRows key is 0 to 16. However, if the value is 0, the number of source rows scanned is 16384. Keep in mind that a value of zero may cause a small performance hit if the source file is very large."

    To see if this is the problem at all the best test would be to open a CSV where the first row contains over 300 characters.

    If this is the problem, my preferred solution would be to specify the column types of the recordset prior to population but I don't have a set up here to test if that's possible sorry. I will have a look for some references for you though.

    0 讨论(0)
提交回复
热议问题