There are a couple of ways to do this. 

easiest way ( might not be the best way )
Is to just read the text file to it's end and dump it into a single record. 

What you will need:

A database ( access will do )
Table structure:
id ( autonumber )
Name ( text ) =  filename you read from 
Data ( memo ) =  data from file

Code:

Use server.mappath and some code to read the file into a variable. 
example:
http://aspnet.4guysfromrolla.com/articles/051802-1.aspx

Build a query to insert it into the database
simple way:

insert into datfiles values ('"& textfilename &"','"& textfiledata &"')

where datfiles is the table name.

then execute the query. ( lot of examples for this around the Net )

This is the simples aproach. 

Good luck 



On 7/2/05, csphek <[EMAIL PROTECTED]> wrote:
> Hi,
> Need help & advise on how to create a asp page to open a .dat file
> and copy the data to a database (not sure which type database to use
> yet.Access? or any recommandation?)User just key in the file name
> (12345.dat) and automatically it will open the file and copy the
> data to a database....it's a simple dat file consit of 15 data:-
> 
> 1 512.34 88.22 11.88
> 2 533.23 87.18 12.82
> 3 533.23 88.00 12.00
> 4 512.34 88.22 11.88
> 5 533.23 87.18 12.82
> 6 533.23 88.00 12.00
> 7 512.34 88.22 11.88
> 8 533.23 87.18 12.82
> 9 533.23 88.00 12.00
> 10 512.34 88.22 11.88
> 11 533.23 87.18 12.82
> 12 523.23 88.00 12.00
> 13 512.34 88.22 11.88
> 14 533.23 87.18 12.82
> 15 533.23 88.00 12.00
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
>


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to