Results 1 to 5 of 5

Thread: [2005] application to load data into database

Hybrid View

  1. #1

    Thread Starter
    Lively Member nudge's Avatar
    Join Date
    Apr 2007
    Location
    There !
    Posts
    111

    Unhappy [2005] application to load data into database


    Good Morning,

    I'm a bit new to ASP.NET and VB.NET .. and programming in general ..
    not a proffesional yet! .. not experienced that much
    that what I meant

    I have to create an application in ASP.NET 2.0 to load a data file into the server
    and then, Grab data that it contains into database

    each data should go to a specific row,
    and that data file is a bit large .. its size may reach 4 MB sometimes
    and it contains a kind of 1000 records and sometimes it exceeds that number


    a have written a code to read the data line by line,
    displayed them in a message box ..

    the problem is, how to extract each data each time !!
    and each record is separated from others by pluses signs ..

    the file might look like this:

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ID: ED0032339 Company/DEP: fin/ name: XXXXXXXXXXXXXXX
    employment date/time: 24-July-07,14:10:24 salary: 8988.00

    ---------------------------------------------------------------------
    Emp info : XXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    ---------------------------------------------------------------------

    ---------------------------------------------------------------------

    More information:
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxx x xxxxxxxxxxxxxx
    xxxxxxxxxx xxxxxxxxxxxxxxxxxx

    vvvvvvvvvvv
    vvvvvvvvv vvvvvvvvvvvvvvv vvvvvvvvvv

    2) xxxxxxxxxxxxxxx x xxxxxxxxxxxxxxxxxx xxx

    3) xxxx: xxxxxxxxxxxxxxxx/xxxxxxxxxxx

    ---------------------------------------------------------------------

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    any Idea !?

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

    Re: [2005] application to load data into database

    What you need is string manipulation.

    Assuming that the data will always be in this format, there are certain things you can look for in the data in the file which you can parse out.

    This one seems simple enough. First separate it out by the +++++++++++ signs. Then find each ----------------- line, and separate out the info between them. For this, you can use String.Split (check it out on MSDN)

    However, don't just pass String.Split the entire 4MB! Instead, as you are reading the file, everytime you reach a set of +++++++++++ you know you're at the end of one record, so pass the string between the previous ++++++++++++ and the current ++++++++++ to a method that will take the string and (since it's smaller), parse it out properly.

  3. #3

    Thread Starter
    Lively Member nudge's Avatar
    Join Date
    Apr 2007
    Location
    There !
    Posts
    111

    Re: [2005] application to load data into database

    thank u,

    but how to separate out the info between --------------------- ???

    which function do i need to use?

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

    Re: [2005] application to load data into database

    String.Split

  5. #5

    Thread Starter
    Lively Member nudge's Avatar
    Join Date
    Apr 2007
    Location
    There !
    Posts
    111

    Re: [2005] application to load data into database

    Thank U mendhak

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