|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
||||
|
||||
|
Error+reading+csv+File
Hi all,
i am not able to read alphabet data from csv file using Ado in VB. In the following it gives error in the first record itself it gives the following error. Run-time error '-2147467259(80004005)' [Microsoft][ODBC Text Driver] Numeric field Overflow. This is the CSV file CID,DATE1,SYMBOL,CODE,FLAG,QTY,RATE AC002,26/11/2004,RELIANCE,NSE,Buy,100,300 AC001,20/11/2004,532517,BSE,Buy,75,200 AC001,25/11/2004,532300,BSE,Buy,500,500 AC001,26/11/2004,RELIANCE,NSE,Buy,100,300 AC001,26/11/2004,523072,BSE,Buy,200,500 AC001,29/11/2004,AARTIDRUGS,NSE,Buy,100,100 This is the code for reading the file cn1.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:/;Extended Properties=text;HDR=YES;FMT=Delimited" rs.Open "select * from temp1.csv", cn1, adOpenKeyset, adLockPessimistic, adCmdText If rs.RecordCount > 0 Then rs.MoveFirst Do Until rs.EOF scode = IIf(Not IsNull(rs.Fields.Item("SYMBOL")), rs.Fields.Item("SYMBOL"), "Null") sclose = IIf(Not IsNull(rs.Fields.Item("RATE")), rs.Fields.Item("RATE"), 0) sdate = IIf(Not IsNull(rs.Fields.Item("DATE1")), rs.Fields.Item("DATE1"), "Null") MsgBox scode rs.MoveNext Loop End If End Sub If anyone can please help me out with this Thanx in advance i can't use 'cn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/;Extended Properties=text;HDR=YES;FMT=Delimited" its showing error as Run-time error '-2147467259(80004005)' Couldnot fine installable ISAM |
|
#2
|
||||
|
||||
|
Just curious but... what types did you declare for your variables scode, sclose and sdate?
You might look at all your types and see if you have too narrow of a type (for example tinyint instead of int). |
|
#3
|
||||
|
||||
|
hey i have kept all the types as general in excel and then i converted to csv file and even if i keep them as text its giving me the same error coz after i close the excel file and reopen it the type is shown as general only.
Quote:
|
|
#4
|
||||
|
||||
|
Quote:
Dim sdate as Date sdate.Format(dd/mm/yyyy) Check the debugger to see what line is highlighted when you get the error. That will help in figuring out the problem as well. I hope this helps you. let me know ![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Error+reading+csv+File |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|