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:
  #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: 19
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,840 Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 5 h 6 m 35 sec
Reputation Power: 1266
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: 19
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,840 Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level)Lauramc User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 5 h 6 m 35 sec
Reputation Power: 1266
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





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

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





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek