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!

urgent help needed

Status
Not open for further replies.

QLearnerNow

Programmer
Jul 1, 2003
22
AU
QLearnerNow (Programmer) Aug 26, 2003
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???

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?



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

if anyone can help please let me know asap

Regards,
QLearnerNow



 
Try maybe the CONVERT syntax instead of CAST?
 
And if the values in the csv are surrounded by quotes ?

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top