ASP error 424 Object required

Posted by jeff on Stack Overflow See other posts from Stack Overflow or by jeff
Published on 2010-06-11T11:11:00Z Indexed on 2010/06/15 16:02 UTC
Read the original article Hit count: 156

Filed under:
|
|
|

I've got a problem with the following code pasted below, the problem seems to be coming from the openastextstream this carries on from another question:

Set str_text_stream = obj_file.OpenAsTextStream(ForReading, TristateUseDefault) 
response.Write "<table>"
int_j = 0
int_x = 0
Err.number = 0
Do While Not str_text_stream.AtEndOfStream

str_po_insert_sql = "INSERT into tbl_purchase_orders (purchase_order_number, purchase_order_vendor_number, purchase_order_vendor_name) "
str_po_insert_sql = str_po_insert_sql & " VALUES ("

str_line = str_text_stream.readline
    arr_line = Split(str_line, """,""", -1)
    if Ubound(arr_line) <> 2 then
        Response.write "<tr><td>The line " & str_line & " could not be imported.</td></tr>"
        int_x = 1
    else
        int_y = Instr(arr_line(2), """,") - 1
        str_field_0 = Replace(arr_line(0), """", "")
        str_field_0 = Replace(str_field_0, "'", "''")
        str_field_1 = Replace(arr_line(1), "'", "''")
        str_field_2 = Left(arr_line(2), int_y)
        str_field_2 = Replace(str_field_2, "'", "''")
        str_po_insert_sql = str_po_insert_sql & "'" & str_field_0 & "', '" & arr_line(1) & "', '" & str_field_2 & "')"
        rs_po_insert.Open str_po_insert_sql, dbConnection, 3
        if Err.number <> 0 then
            Response.write "<tr><td>The line " & str_po_insert_sql & " was imported.</td></tr>"
        end if
        Err.number = 0
        int_j = int_j + 1
    end if

loop

data from test import:

"4501366934","800002","Clancy Docwra Ltd",04/05/2010 00:00:00
"4501366935","800004","Clancy Docwra Ltd",04/05/2010 00:00:00
"4501366936","800004","Clancy Docwra Ltd",04/05/2010 00:00:00

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server