Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extremely Urgent

Status
Not open for further replies.

QLearnerNow

Programmer
Jul 1, 2003
22
AU
Hi Guys,

I have created a recordset to a csv file. The csv file has an field called account number. some of the values in account number exceeds the integer data type capacity. The recordset retrieves these values as Nulls. How do I get around this problem.

Is there anyway I can read the input into the recordset as text???

I hope you guys can give me an answer asap.

Thanks again for all your help

Regards,
QLearnerNow
 
Instead of the VBscript subtype Integer, use the subtype Long.
See this page:
Or yes, you could change it to a string since its going to be one in the file. At a guess, just remove whatever you have done to convert it to an Integer..

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Dim rsNav, ClientID, strSql
Dim rsNav_numRows
FileCleanse
Set rsNav = Server.CreateObject("ADODB.Recordset")
rsNav.ActiveConnection = MM_CMT_STRING
rsNav.Source = "SELECT * FROM NavigatorCleanse.csv Order By InvestorAccNum"
rsNav.CursorType = 0
rsNav.CursorLocation = 2
rsNav.LockType = 1
rsNav.Open()

rsNav_numRows = 0

thats my recordset

Response.Write rsNav(&quot;InvestorAccNum&quot;) & &quot; &quot; & rsNav(&quot;InvestmentDescription&quot;) & &quot; &quot; & rsNav(&quot;NumUnits&quot;) & &quot; &quot; & rsNav(&quot;APIRCode&quot;) & &quot; &quot; & rsNav(&quot;ASXCode&quot;) & &quot;<br>&quot;

thats how I call it in a loop

if my csv file has a InvestAccNum value of 7890840000 it comes out as null as it exceeds the maximun int data type value. How do i set it to float or text?

Thanks for your help.

QLearnerNow
 
[tt]rsNav(&quot;InvestorAccNum&quot;)[/tt]
This gives a string. Nowhere does it convert to an int -

can you search your page for &quot;int&quot; or &quot;CInt&quot;? The code you posted doesn't convert it, but somewhere you must be.

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
rsNav(&quot;InvestorAccNum&quot;)

this is returning an int im not doing any conversion to int not using Cint anywhere. rsNav(&quot;InvestorAccNum&quot;) just seems to come as an int.

im trying to use this statement now
rsNav.Source = &quot;SELECT CAST(InvestorAccNum AS nvarchar)AS Acc FROM NavigatorCleanse.csv&quot;

but I get this error

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Text Driver] Syntax error (missing operator) in query expression 'CAST(InvestorAccNum AS nvarchar)'.

I dont think we can use CAST with csv files
 
hrm - I thought you were reading from a DB and outputting to a .csv file. My mistake.

Maybe someone else has experience with reading from a .csv file - if not here you could try the VBscript forum(forum329), generally more likely to get a file-related answer there..

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top