Results 1 to 5 of 5

Thread: [RESOLVED] Error Reading Text File From Client PC

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Resolved [RESOLVED] Error Reading Text File From Client PC

    I have the code below. On my web page, I have a textbox and a
    button. User enters the filename and path (ex. c:\test.txt) on the textbox and clicks on the button to process the file.

    If I run it on the machine hosting the site, I have no errors.
    However, when I run it on a client PC, I get an error. It's not
    reading the file entered into the textbox.

    Am I missing anything here? Why would it not read the text file in the client PC?

    TIA


    VB Code:
    1. Imports System.IO
    2. Imports System.Data.SqlClient
    3.  
    4.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    5.  
    6.         Dim strFILELINE As String
    7.         '+-------------------+
    8.         '| INITIALIZE ARRAYS |
    9.         '+-------------------+
    10.         Dim arLINEREAD() As String
    11.  
    12.         '+-----------------------+
    13.         '| OPEN THE FILE TO READ |
    14.         '+-----------------------+
    15.         Dim objStreamReader As StreamReader
    16.         objStreamReader = File.OpenText(TextBox1.Text)
    17.  
    18.         '+-------------------------+
    19.         '| READ ONE LINE AT A TIME |
    20.         '+-------------------------+
    21.         While objStreamReader.Peek() <> -1
    22.             '+--------------------------------+
    23.             '| PLACE LINE DATA INTO THE ARRAY |
    24.             '+--------------------------------+
    25.             arLINEREAD = Split(objStreamReader.ReadLine(), ",")
    26.             '+--------------------------------+
    27.             '| PROCESS LINE TO THE SQL SERVER |
    28.             '+--------------------------------+
    29.             ADD_ENTRIES(arLINEREAD(0).ToString, arLINEREAD(1).ToString, arLINEREAD(2).ToString, Session.SessionID)
    30.         End While
    31.  
    32.         '+--------------+
    33.         '| CLOSE OBJECT |
    34.         '+--------------+
    35.         objStreamReader.Close()
    36.  
    37.         '+--------------------------+
    38.         '| DISPLAY INFO TO THE GRID |
    39.         '+--------------------------+
    40.         With DataGrid1
    41.             .CurrentPageIndex = 0
    42.             .DataSource = GetVERIZONList(Session.SessionID)
    43.             .DataBind()
    44.             .Visible = True
    45.         End With
    46.  
    47.     End Sub
    48. End Class
    Last edited by ARPRINCE; Oct 26th, 2004 at 04:01 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width