How to save the Dataset to a new file using today's Date as filename?

Hi,

I am using Provider=Microsoft.Jet.OLEDB.4.0 connection to load and save my database to file.

I have created datatable in a dataset. and I would like to save this datatable/dataset to a new file created using todays date as the filename.

e.g. checks if the file exist, then otherwise create a new file called "14-07-2004.mdb"

I guess the checking if the file exist is easy, but I don't how to create new file in ADO.net and using the date as a filename.

Any help would be appreciate!

many many thanks.
stainesAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
RonaldBiemansConnect With a Mentor Commented:
0
 
Hans LangerCommented:
Hi !
You want to create a file from de dataset ?, with what format ?
0
 
checooCommented:
if you want to save it as XML then its easy

datset.getXML(filename)
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
stainesAuthor Commented:
I mention as above, i want to create a database file using the data as "15-10-2004.mdb"

a .mdb file...

thanks.
0
 
RonaldBiemansCommented:
Hi staines,

look here for a
0
 
Hans LangerCommented:
nice article.

now, just change:

 cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                 "Data Source=D:\AccessDB\NewMDB.mdb;" & _
                 "Jet OLEDB:Engine Type=5")

to

 cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & _
                 "Data Source=D:\AccessDB\"  & Now.Date.ToString("dd-MM-yyyy") & ".mdb;" & _
                 "Jet OLEDB:Engine Type=5")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.