|
-
Apr 11th, 2007, 02:42 AM
#1
Thread Starter
Lively Member
[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 !?
-
Apr 11th, 2007, 09:34 AM
#2
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.
-
Apr 19th, 2007, 12:57 AM
#3
Thread Starter
Lively Member
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?
-
Apr 19th, 2007, 08:26 AM
#4
Re: [2005] application to load data into database
-
Apr 21st, 2007, 05:45 PM
#5
Thread Starter
Lively Member
Re: [2005] application to load data into database
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|