data access RRS feed

  • Question

  • User1248258412 posted

    can anyone guide me on, are there anyway can we read the email data and store it into database? they can be difference type of email format but with same field to be fill into database.

    Tuesday, December 22, 2009 12:31 AM

All replies

  • User-952121411 posted

    Well the requirements you posted are a bit vague, but lets divide this into (2) objectives:

    1. Read and parse an Email
    2. Store the parsed email data into the database

    Ok, #2 above is no problem.  There are a bunch of ways to store the data in the database.  The simplest being to fill some type of ADO.NET object like a DataTable and then persisting that data to a database using a stored procedure or SQL.  With a little more explanation on your setup, more specific advice can be giving on how to move the data.

    The problem I see is with #1 above.  I need some more information to determine what you are trying to do, and how you are thinking of doing it.  If the email is in some 3rd party website displaying emails, it is going to be difficult to scrape that data.  Now if you want to act as the email server and bring in the emails via .NET, you should be able to read the emails and parse out the data accordingly.  For example look at the following .NET component which claims: "4AspNet POP3 is a powerful, inexpensive, and easy to use component which allows you to download and parse emails from a POP3 server."


    If you want to provide some more specific detail, I am sure some more advice can be given.

    Tuesday, December 22, 2009 10:03 AM
  • User1248258412 posted

    thanks atconway, the email will be send to generic mailbox, and i need to read from that. The email may have several difference type, but the detail information to be store in DB will be same.  And as you mention, there is stored procedure or SQL can did that, maybe i know where can i find the sample to do so? Thank

    Tuesday, December 22, 2009 10:31 AM
  • User-952121411 posted

    And as you mention, there is stored procedure or SQL can did that, maybe i know where can i find the sample to do so?

    Well if you do want to insert this data by parsing the data out into an ADO.NET object, and then persisting that data to the database, I would start by looking at the following:

    DataSets, DataTables, and DataViews (ADO.NET):


    The link above has several links and information on how to use DataTables, etc. and that should get you going in the right direction.  However, I am still not sure of your experience level, so that might not be the way you want to go.  If you want to reply back with how you planned to get the data to the database more specifically, that may help with people to provide more advice.

    There are so many other ways to do what I think you are attempting to do, but yet the details on what you want to do are still a bit abstract.  Another way to handle the data is to work with custom classes that you create to store the data, and then those objects can be passed around, and eventually have their data persisted to the database as well.

    At this point using a component like the one from the link I provided in conjunction with whatever data architecture you want to use should satisfy the requirements.


    Wednesday, December 23, 2009 8:57 AM
  • User1248258412 posted

    i have try the ways, but i still having problem to read the email into the DataTables? So, i was thinking is that possible just create stored procedure to read the data and direct store the value into database without using ADO.Net object?

    Sunday, December 27, 2009 8:23 PM
  • User1248258412 posted

    did anyone know how to do that? i need to store the email data to Database.

    Wednesday, December 30, 2009 8:21 PM
  • User504625014 posted

    i need to store the email data to Database.

    There is no straight answer to this question. What I would advise is, you break the problem in sub tasks like already done by atconway.

    1. Reading data from Email

    2. Saving in to database.

    Try to break it further with specific details like what type of email client, what type of data is there in the email and what your thought process on that.

    It would be good to target parts of your problem.




    Thursday, December 31, 2009 1:30 AM
  • User1248258412 posted

    did anyone know how to write the store procedure to read the data from DataTable into database?

    Sunday, January 3, 2010 9:02 PM