HELP ::: Excel Import (overflow problem)

Results 1 to 2 of 2

Thread: HELP ::: Excel Import (overflow problem)

  1. #1
    Join Date
    Dec 1969

    Default HELP ::: Excel Import (overflow problem)

    Hi,<BR><BR>I keep getting the following error while trying to import data from the excel (.xls) to SQL 7 database: <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80004005&#039; <BR><BR>[Microsoft][ODBC Excel Driver] Numeric field overflow. <BR><BR>All the fiels in the SQL are in VCHAR format except the 2 date fields. (total : 8 fields, with the first being a auto increment ID fields)<BR><BR>The code somehow succesfully imported 2 records and then the error came. All rows (about 90 in total) are in identcal format.<BR><BR>Typical row in the excel (I&#039;ve used &#039;,&#039; to seperate the field here) :<BR><BR><BR>DT123 , FGT , MIB , 29/08/2003 , 1330 , 29/08/2003 , 1430 <BR><BR><BR><BR>The code as follows : <BR><BR>exceldb = "excel/file2" <BR><BR><BR> Set cn = Server.CreateObject("ADODB.Connection")<BR> cn.Open "DBQ=" & Server.MapPath(exceldb) & ";" & _<BR> "DRIVER={Microsoft Excel Driver (*.xls)};"<BR><BR><BR> Set rs = Server.CreateObject("ADODB.Recordset")<BR> sql="select * from m_num;"<BR><BR> rs.Open sql, cn,1,1<BR> <BR> &#039;Getting stat to make sure everything is correct<BR> strXrecord = rs.recordcount <BR> strColumn = rs.fields.count <BR> <BR> response.write strXrecord &"<BR>" &strColumn &"<BR>"<BR> <BR> <BR> <BR><BR> response.write "Importing Data ..." &"<BR>" <BR> do while not rs.eof <BR> <BR> <BR> <BR> strFnum = rs.fields.item(0).value <BR> strFfrom = rs.fields.item(1).value <BR> strFto = rs.fields.item(2).value <BR> strDdate = rs.fields.item(3).value <BR> strDtime = cstr(rs.fields.item(4).value)<BR> strAdate = rs.fields.item(5).value <BR> strAtime = cstr(rs.fields.item(6).value )<BR> <BR> <BR> &#039;add process <BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "tb_data", oConn, adOpenKeySet, adLockOptimistic, adCmdTable<BR> objRS.AddNew<BR> <BR> <BR> objRS("FNUM") = strFnum<BR> objRS("FFROM") = strFfrom<BR> objRS("FTO") = strFto<BR> objRS("DDATE") = strDdate<BR> objRS("DTIME") = strDtime<BR> objRS("ADATE") = strAdate<BR> objRS("ATIME") = strAtime<BR><BR> <BR> objRS.Update<BR> <BR><BR> <BR> objRS.close<BR> set objRS = nothing<BR> <BR> <BR> <BR> rs.movenext<BR> loop<BR> strMsg = "Import completed"<BR><BR> <BR> rs.close<BR> set rs = nothing<BR><BR><BR><BR><BR><BR>Can anyone take a quick look and help me please....<BR><BR>many thanks<BR><BR>James<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: HELP ::: Excel Import (overflow problem)

    Have you trued changing you field fnumb (or whatever field is causing the error) to text/string and then importing?<BR><BR>I would try running cstr() on all of the fields.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts