Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old December 6th, 2004, 06:21 AM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
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

Reply With Quote
  #2  
Old December 8th, 2004, 01:21 PM
Lauramc's Avatar
Lauramc Lauramc is offline
SQL Slarentice
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2004
Location: In My Happy Place
Posts: 1,782 Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 15 h 42 m 2 sec
Reputation Power: 1081
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).

Reply With Quote
  #3  
Old December 8th, 2004, 11:28 PM
hithere's Avatar
hithere hithere is offline
Learner
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: India
Posts: 450 hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level)hithere User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 12 h 13 m 21 sec
Reputation Power: 17
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:
Originally Posted by Lauramc
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).

Reply With Quote
  #4  
Old December 9th, 2004, 01:13 PM
Lauramc's Avatar
Lauramc Lauramc is offline
SQL Slarentice
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2004
Location: In My Happy Place
Posts: 1,782 Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level)Lauramc User rank is General 2nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 15 h 42 m 2 sec
Reputation Power: 1081
Quote:
Originally Posted by hithere
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.
Sorry, I meant in your code. Did you declare the variables scode, sclose and sdate? For example... Dim scode as String etc? If you declared sdate as a date you may want to check that your date format is set to dd/mm/yyyy. If not, it may be the date format of your "DATE1" field that is causing the overflow. Try this:

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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Error+reading+csv+File


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway