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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display information from CSV file on website

Status
Not open for further replies.

Richo1980

Programmer
Apr 12, 2006
27
AU
Hi everyone,

Apologies if this is not the correct forum to post this in...

I am trying to display information from a csv file on a website. This is what I have so far...(I know this is wrong, but I've only extracted info from Access databases before using SQL :( )

Code:
<%
set conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq="& strPath &";Extensions=asc,csv,tab,txt;Persist Security Info=False"
strFile = "HD_Closed.csv"
strPath = "\\server\c$\inetpub\[URL unfurl="true"]wwwroot\Stats\Stats\db2"[/URL]

'set rs = Server.CreateObject("ADODB.recordset")
rs.Open "select HD_Name, Total FROM "& strFile &""
%>

<table align="center" border="1" size="100%">
	<tr>
		<td class="hnav">
			<b>Name</b>
		</td>
		<td class="hnav">
			<b>Total</b>
		
	</tr>	
<%for each x in rs.Fields
    next%>
</tr>
<%do until rs.EOF%>
    <tr>
    <%for each x in rs.Fields%>
       <td><%Response.Write(x.value)%></td>
    <%next
    rs.MoveNext%>
    </tr>
<%loop
rs.close
conn.close
%>

Could anyone please tell me what I am doing wrong?

Thanks
Samantha
 
yup, wrong forum, your looking for ASP forum333.

A csv file is essentially a text file so I would recommend using "scripting.filesystemobject". Look this up on google and you will find plenty of examples of how to pull this in and then "split" each value by it's delimiter.

Nick
 
Richo,

Why is it in some of your posts you call yourself Dave, and in some you call yourself Samantha? You're not trying to solicit quicker help by pretending to be a female, are you?

Just interested ;-)

Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top