Code
<%
Set conn = server. Createobject ("ADODB. Connection ")
Conn. provider = "Microsoft. Jet. oledb.4.0"
Dbpath = server. mappath ("qipu. mdb ")
Conn. Open dbpath
Strfilename = request. querystring ("file1 ")
Set rs = server. Createobject ("ADODB. recordset ")
Dim FSO
Dim myfile
Dim titleindex
Dim cateindex
Dim picindex
Dim detailindex
Dim Arr ()
Set FSO = server. Createobject ("scripting. FileSystemObject ")
Set myfile = FSO. opentextfile (server. mappath ("1111.csv"), 1, true,-1)
'A.txt and ASP are in the same directory. If they are not in a directory, you can use absolute scripts to change a.txt from the current row to: D: \ a.txt.
%>
<Table border = "1">
<%
Mynum = 0
While not myfile. atendofstream
If mynum = 0 then
Row = Split (myfile. Readline ,"")
For I = 0 to ubound (ROW)
Myvar = row (I)
Select case myvar
Case "baby name" titleindex = I
Case "Baby category" cateindex = I
Case "New Image" picindex = I
End select
Next
End if
Row = Split (myfile. Readline ,"")
%>
<Tr>
<%
'For I = 0 to ubound (ROW)
'Td = row (I)
Title = row (titleindex)
PIC = row (picindex)
Cate = row (cateindex)
SQL = "insert into product (title, PIC, cate) values ('" & Title & "', '" & PIC & "', '" & Cate &"')"
Rs. Open SQL, Conn
%>
<TD> <Div style = "overflow: hidden; width: 200px; Height: 30px; "> <% = title %> </div> </TD> <Div style =" overflow: hidden; width: 200px; Height: 30px; "> <% = PIC %> </div> </TD> <Div style =" overflow: hidden; width: 200px; Height: 30px; "> <% = Cate %> </div> </TD>
<%
'Next
%>
</Tr>
<%
Mynum = mynum + 1
Wend
Myfile. Close
Set myfile = nothing
Set FSO = nothing
%>
</Table>