Results 1 to 10 of 10

Thread: Reading a File

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    58

    Reading a File

    How can read the file with the extension .mir

    please help me out

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Reading a File

    Is it just a text file?

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Reading a File

    http://filext.com/detaillist.php?extdetail=mir

    It's probably a complex file, so you should look to see if Bauhaus has any APIs you can use to understand the file. Else all you'll get is a bunch of gibberish.

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    58

    Re: Reading a File

    Hi all ,
    I converted that .mir file to .xls file
    but i need to read this .xls in asp.net letter by letter
    bcoz the data excel is not in a table format

    if there is any solution pls help me out

    Thanks in advance
    Sathish..

  5. #5
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Reading a File

    In excel is it just a bunch of text within the first cell? If so you could use ADO.net to read the data into a variable, then go through it character by character.

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    58

    Re: Reading a File

    Hi Wild bill
    can u plesae tell me how to read the excel cell through ado.net

    thanks in advance
    Sathish

  7. #7
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Reading a File

    Try this
    VB Code:
    1. Public Function GetExcelData(ByVal fileName As String, ByVal sheetName As String) As String
    2.         Dim mySelectQuery As String = "select * from [" & sheetName & "$]"
    3.         Dim myConnection As New OleDbConnection( _
    4.                   "provider=Microsoft.Jet.OLEDB.4.0; " & _
    5.                   "data source=" & fileName & _
    6.                   ";Extended Properties=""Excel 8.0;HDR=No""")
    7.         Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
    8.         myConnection.Open()
    9.         Dim myReader As OleDbDataReader = myCommand.ExecuteReader()
    10.         ' Always call Read before accessing data.
    11.         myReader.Read()
    12.         'get first value of first row
    13.         Dim info As String = Convert.ToString(myReader.GetValue(0))
    14.         ' always call Close when done reading.
    15.         myReader.Close()
    16.         ' Close the connection when done with it.
    17.         myConnection.Close()
    18.  
    19.         Return info
    20.  
    21.     End Function

  8. #8

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    58

    Re: Reading a File

    Hi to all i am able to read the file in to one string

    but how to read the required characters(bytes) from that stirng

    i mean how to read 1 st character to 5 th character like and so on....

    is there any file sytem objects to read the whole string
    pls help me out


    thanks in advance
    Sathish

  9. #9
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Reading a File

    Now that you've got your text into a string, you can use string methods, specifically substring, to grab chunks of text:
    VB Code:
    1. For i as integer = 0 to info.length - 1
    2.   console.writeline(info.substring(i,1))
    3. Next

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2005
    Posts
    58

    Re: Reading a File

    thanx a lot it's working

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