By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,171 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,171 IT Pros & Developers. It's quick & easy.

Writing data to disk?!

P: n/a
I'd like to get some feedback on the issue of storing data out to disk and
where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that you
can link to a database in your program and read and write to the database
etc etc. Well, that's all find and dandy but what if the person you're
writing the application for doesn't have SQL/Access or some other database
provider to use? Does Microsoft provide a class library to make disk/data
storage simpler without having to write individual pieces of data out to
disk? I've done a bit of searching through the MSDN online documentation
using Serialization, marking code as serializable, and then writing it out
to disk...and actually got it to work...but is this efficient or does MS
have another way that's simpler? I'd just like some feedback if anyone has
the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
Dec 20 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Use the System.IO namespace and read up on
StreamReader, StreamWriter, BinaryReader and
BinaryWriter.

These class are so simple to use that creating some
elaborate infrastructure to write data to disk would
be a waste of time.

for example, if you wanted to write a text file out:

using (StreamWriter s = new StreamWriter(@"C:\temp\test.txt",false))
{
s.WriteLine(FileContents);
s.Close();
}

you could also spit your DataSet out to xml with
the .WriteXml method.

Or

You could store your data in an XmlDocument
and use its .Save method to write it to disk.

There are all sorts of things you can do if
you don't need shared access to data or
centralized access.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk and
where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the person
you're writing the application for doesn't have SQL/Access or some other
database provider to use? Does Microsoft provide a class library to make
disk/data storage simpler without having to write individual pieces of
data out to disk? I've done a bit of searching through the MSDN online
documentation using Serialization, marking code as serializable, and then
writing it out to disk...and actually got it to work...but is this
efficient or does MS have another way that's simpler? I'd just like some
feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator

Dec 20 '05 #2

P: n/a
Me
What you really need to ask yourself is how you or your customer wants to
store "data" and what exactly the "data" is. Different formats (database,
flat file, etc) have pro's and con's with them and they need to be
considered when making this decision. You should not look for the "simple"
way to do data storage but instead look for the method that gives you and/or
your customer what is needed.

For instance here are some questions/thoughts for you to consider when
choosing a data storage design.

Is the data going to be shared (updated, added to, deleted from, etc) my
multiple users? If so then a DB is better because it has the notion of
locking records.

Is the data very simple? Maybe an XML file would work if it is only
configuration information being saved.

Will there be the notion of multiple instances of these files (user 1, user
2, etc.)? Maybe flat files would be better for this.

Will there be only 1 instance that is shared by multiple users? Maybe a DB
would be better.

How will the data be upgraded? How will this be handled - copies of
files/tables or some other method.

Will you need want to keep a "roseta stone" (aka key) to some home brewed
file format? This is something that you will need if you do not follow some
standard format (database, xml, etc). You dont want to open up a file and
have a bunch of garbage in it and have no clue what it is do you?

Is it a bunch of small values or only 1 or 2 large/huge values (such as an
image)?

Will you need to query this data for a report or something? Databases are
great for this!

Who will be responsible for backing up the data? Your program (maybe flat
files are better) or will your customers IT department handle this (database
server is better maybe)? This is a very important one to keep in mind since
if your program handles user entered data they will want a backup to be done
at some point and if you can push it off on them then it is one less thing
for you to worry about when the system crashes!

As for what options you have here are a few that I can think of. I am sure
there are others though.
- Database servers (SQL Server, MySQL, etc.)
- Database files (Access, etc.)
- XML
- INI files
- Registry
- Flat text files
- Flat binary files (home brewed files)

What is all comes down to is requirements. Either the ones your customer
imposes on you, or the ones that your application imposes on your customer.
You cannot support everything in every application... or can you? :-)

Hope this helps!
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk and
where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the person
you're writing the application for doesn't have SQL/Access or some other
database provider to use? Does Microsoft provide a class library to make
disk/data storage simpler without having to write individual pieces of
data out to disk? I've done a bit of searching through the MSDN online
documentation using Serialization, marking code as serializable, and then
writing it out to disk...and actually got it to work...but is this
efficient or does MS have another way that's simpler? I'd just like some
feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator

Dec 20 '05 #3

P: n/a
Well what I've been trying to do is come up with a program for a local
church that has a donation/redistribution program for used furniture. They
want a small application that can take the place of their current paper
system to make it more cost effective and a bit more efficient and
up-to-date overall. Setting their motives aside, I've designed the entire
interface, gotten their approval, and am now moving on to writing the data
out to disk. My original idea was to create an Access database file for
storage of records to make for really easy data access and searching
capabilities. My problem now becomes...how do I do this in C#? What if
they don't have MS Access? Can I still have the application create an
access database on their machine? What built in .NET framework classes
handle working with Access databases? I did have some direction in which I
was heading but I'm stumped as to how to create the Access file on the fly
and get the data to and from that file. Thanks for the responses I've
received already...I do appreciate any other input that you have.

Chris
--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Me" <me@home.com> wrote in message
news:Gc********************@comcast.com...
What you really need to ask yourself is how you or your customer wants to
store "data" and what exactly the "data" is. Different formats (database,
flat file, etc) have pro's and con's with them and they need to be
considered when making this decision. You should not look for the
"simple" way to do data storage but instead look for the method that gives
you and/or your customer what is needed.

For instance here are some questions/thoughts for you to consider when
choosing a data storage design.

Is the data going to be shared (updated, added to, deleted from, etc) my
multiple users? If so then a DB is better because it has the notion of
locking records.

Is the data very simple? Maybe an XML file would work if it is only
configuration information being saved.

Will there be the notion of multiple instances of these files (user 1,
user 2, etc.)? Maybe flat files would be better for this.

Will there be only 1 instance that is shared by multiple users? Maybe a DB
would be better.

How will the data be upgraded? How will this be handled - copies of
files/tables or some other method.

Will you need want to keep a "roseta stone" (aka key) to some home brewed
file format? This is something that you will need if you do not follow
some standard format (database, xml, etc). You dont want to open up a file
and have a bunch of garbage in it and have no clue what it is do you?

Is it a bunch of small values or only 1 or 2 large/huge values (such as an
image)?

Will you need to query this data for a report or something? Databases are
great for this!

Who will be responsible for backing up the data? Your program (maybe flat
files are better) or will your customers IT department handle this
(database server is better maybe)? This is a very important one to keep in
mind since if your program handles user entered data they will want a
backup to be done at some point and if you can push it off on them then it
is one less thing for you to worry about when the system crashes!

As for what options you have here are a few that I can think of. I am sure
there are others though.
- Database servers (SQL Server, MySQL, etc.)
- Database files (Access, etc.)
- XML
- INI files
- Registry
- Flat text files
- Flat binary files (home brewed files)

What is all comes down to is requirements. Either the ones your customer
imposes on you, or the ones that your application imposes on your
customer. You cannot support everything in every application... or can
you? :-)

Hope this helps!
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk
and where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the person
you're writing the application for doesn't have SQL/Access or some other
database provider to use? Does Microsoft provide a class library to make
disk/data storage simpler without having to write individual pieces of
data out to disk? I've done a bit of searching through the MSDN online
documentation using Serialization, marking code as serializable, and then
writing it out to disk...and actually got it to work...but is this
efficient or does MS have another way that's simpler? I'd just like some
feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator


Dec 20 '05 #4

P: n/a
SQL 2005 Express (free).

--

Derek Davis
dd******@gmail.com

"Chris Springer" <cs*****@adelphia.net> wrote in message
news:VJ******************************@adelphia.com ...
Well what I've been trying to do is come up with a program for a local
church that has a donation/redistribution program for used furniture.
They
want a small application that can take the place of their current paper
system to make it more cost effective and a bit more efficient and
up-to-date overall. Setting their motives aside, I've designed the entire
interface, gotten their approval, and am now moving on to writing the data
out to disk. My original idea was to create an Access database file for
storage of records to make for really easy data access and searching
capabilities. My problem now becomes...how do I do this in C#? What if
they don't have MS Access? Can I still have the application create an
access database on their machine? What built in .NET framework classes
handle working with Access databases? I did have some direction in which
I
was heading but I'm stumped as to how to create the Access file on the fly
and get the data to and from that file. Thanks for the responses I've
received already...I do appreciate any other input that you have.

Chris
--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Me" <me@home.com> wrote in message
news:Gc********************@comcast.com...
What you really need to ask yourself is how you or your customer wants to
store "data" and what exactly the "data" is. Different formats (database,
flat file, etc) have pro's and con's with them and they need to be
considered when making this decision. You should not look for the
"simple" way to do data storage but instead look for the method that
gives you and/or your customer what is needed.

For instance here are some questions/thoughts for you to consider when
choosing a data storage design.

Is the data going to be shared (updated, added to, deleted from, etc) my
multiple users? If so then a DB is better because it has the notion of
locking records.

Is the data very simple? Maybe an XML file would work if it is only
configuration information being saved.

Will there be the notion of multiple instances of these files (user 1,
user 2, etc.)? Maybe flat files would be better for this.

Will there be only 1 instance that is shared by multiple users? Maybe a
DB would be better.

How will the data be upgraded? How will this be handled - copies of
files/tables or some other method.

Will you need want to keep a "roseta stone" (aka key) to some home brewed
file format? This is something that you will need if you do not follow
some standard format (database, xml, etc). You dont want to open up a
file and have a bunch of garbage in it and have no clue what it is do
you?

Is it a bunch of small values or only 1 or 2 large/huge values (such as
an image)?

Will you need to query this data for a report or something? Databases are
great for this!

Who will be responsible for backing up the data? Your program (maybe flat
files are better) or will your customers IT department handle this
(database server is better maybe)? This is a very important one to keep
in mind since if your program handles user entered data they will want a
backup to be done at some point and if you can push it off on them then
it is one less thing for you to worry about when the system crashes!

As for what options you have here are a few that I can think of. I am
sure there are others though.
- Database servers (SQL Server, MySQL, etc.)
- Database files (Access, etc.)
- XML
- INI files
- Registry
- Flat text files
- Flat binary files (home brewed files)

What is all comes down to is requirements. Either the ones your customer
imposes on you, or the ones that your application imposes on your
customer. You cannot support everything in every application... or can
you? :-)

Hope this helps!
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk
and where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the
person you're writing the application for doesn't have SQL/Access or
some other database provider to use? Does Microsoft provide a class
library to make disk/data storage simpler without having to write
individual pieces of data out to disk? I've done a bit of searching
through the MSDN online documentation using Serialization, marking code
as serializable, and then writing it out to disk...and actually got it
to work...but is this efficient or does MS have another way that's
simpler? I'd just like some feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as
you maintain basic hygiene, you're likely to be okay, but you'll never
be invulnerable.

Steve Shah - Unix Systems Network Administrator



Dec 20 '05 #5

P: n/a
May also want to look at Firebird. It allows you to embed a database into
your application, so the end user doesn't need to have anything else
installed.

http://firebird.sourceforge.net/

Unsure if you can do that with SQL Express...

Derrick

"carion1" <ddavis76 _at_ gmail _dot_ com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
SQL 2005 Express (free).

--

Derek Davis
dd******@gmail.com

"Chris Springer" <cs*****@adelphia.net> wrote in message
news:VJ******************************@adelphia.com ...
Well what I've been trying to do is come up with a program for a local
church that has a donation/redistribution program for used furniture.
They
want a small application that can take the place of their current paper
system to make it more cost effective and a bit more efficient and
up-to-date overall. Setting their motives aside, I've designed the
entire
interface, gotten their approval, and am now moving on to writing the
data
out to disk. My original idea was to create an Access database file for
storage of records to make for really easy data access and searching
capabilities. My problem now becomes...how do I do this in C#? What if
they don't have MS Access? Can I still have the application create an
access database on their machine? What built in .NET framework classes
handle working with Access databases? I did have some direction in which
I
was heading but I'm stumped as to how to create the Access file on the
fly
and get the data to and from that file. Thanks for the responses I've
received already...I do appreciate any other input that you have.

Chris
--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Me" <me@home.com> wrote in message
news:Gc********************@comcast.com...
What you really need to ask yourself is how you or your customer wants
to store "data" and what exactly the "data" is. Different formats
(database, flat file, etc) have pro's and con's with them and they need
to be considered when making this decision. You should not look for the
"simple" way to do data storage but instead look for the method that
gives you and/or your customer what is needed.

For instance here are some questions/thoughts for you to consider when
choosing a data storage design.

Is the data going to be shared (updated, added to, deleted from, etc) my
multiple users? If so then a DB is better because it has the notion of
locking records.

Is the data very simple? Maybe an XML file would work if it is only
configuration information being saved.

Will there be the notion of multiple instances of these files (user 1,
user 2, etc.)? Maybe flat files would be better for this.

Will there be only 1 instance that is shared by multiple users? Maybe a
DB would be better.

How will the data be upgraded? How will this be handled - copies of
files/tables or some other method.

Will you need want to keep a "roseta stone" (aka key) to some home
brewed file format? This is something that you will need if you do not
follow some standard format (database, xml, etc). You dont want to open
up a file and have a bunch of garbage in it and have no clue what it is
do you?

Is it a bunch of small values or only 1 or 2 large/huge values (such as
an image)?

Will you need to query this data for a report or something? Databases
are great for this!

Who will be responsible for backing up the data? Your program (maybe
flat files are better) or will your customers IT department handle this
(database server is better maybe)? This is a very important one to keep
in mind since if your program handles user entered data they will want a
backup to be done at some point and if you can push it off on them then
it is one less thing for you to worry about when the system crashes!

As for what options you have here are a few that I can think of. I am
sure there are others though.
- Database servers (SQL Server, MySQL, etc.)
- Database files (Access, etc.)
- XML
- INI files
- Registry
- Flat text files
- Flat binary files (home brewed files)

What is all comes down to is requirements. Either the ones your customer
imposes on you, or the ones that your application imposes on your
customer. You cannot support everything in every application... or can
you? :-)

Hope this helps!
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk
and where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the
person you're writing the application for doesn't have SQL/Access or
some other database provider to use? Does Microsoft provide a class
library to make disk/data storage simpler without having to write
individual pieces of data out to disk? I've done a bit of searching
through the MSDN online documentation using Serialization, marking code
as serializable, and then writing it out to disk...and actually got it
to work...but is this efficient or does MS have another way that's
simpler? I'd just like some feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as
you maintain basic hygiene, you're likely to be okay, but you'll never
be invulnerable.

Steve Shah - Unix Systems Network Administrator



Dec 20 '05 #6

P: n/a
Ooops...this link is better:

http://www.dotnetfirebird.org/download/
"Derrick" <de***********@hotmail.com> wrote in message
news:m9*******************@news20.bellglobal.com.. .
May also want to look at Firebird. It allows you to embed a database into
your application, so the end user doesn't need to have anything else
installed.

http://firebird.sourceforge.net/

Unsure if you can do that with SQL Express...

Derrick

"carion1" <ddavis76 _at_ gmail _dot_ com> wrote in message
news:Oi**************@tk2msftngp13.phx.gbl...
SQL 2005 Express (free).

--

Derek Davis
dd******@gmail.com

"Chris Springer" <cs*****@adelphia.net> wrote in message
news:VJ******************************@adelphia.com ...
Well what I've been trying to do is come up with a program for a local
church that has a donation/redistribution program for used furniture.
They
want a small application that can take the place of their current paper
system to make it more cost effective and a bit more efficient and
up-to-date overall. Setting their motives aside, I've designed the
entire
interface, gotten their approval, and am now moving on to writing the
data
out to disk. My original idea was to create an Access database file for
storage of records to make for really easy data access and searching
capabilities. My problem now becomes...how do I do this in C#? What if
they don't have MS Access? Can I still have the application create an
access database on their machine? What built in .NET framework classes
handle working with Access databases? I did have some direction in
which I
was heading but I'm stumped as to how to create the Access file on the
fly
and get the data to and from that file. Thanks for the responses I've
received already...I do appreciate any other input that you have.

Chris
--
Securing your systems is much like fighting off disease -- as long as
you maintain basic hygiene, you're likely to be okay, but you'll never
be invulnerable.

Steve Shah - Unix Systems Network Administrator
"Me" <me@home.com> wrote in message
news:Gc********************@comcast.com...
What you really need to ask yourself is how you or your customer wants
to store "data" and what exactly the "data" is. Different formats
(database, flat file, etc) have pro's and con's with them and they need
to be considered when making this decision. You should not look for
the "simple" way to do data storage but instead look for the method
that gives you and/or your customer what is needed.

For instance here are some questions/thoughts for you to consider when
choosing a data storage design.

Is the data going to be shared (updated, added to, deleted from, etc)
my multiple users? If so then a DB is better because it has the notion
of locking records.

Is the data very simple? Maybe an XML file would work if it is only
configuration information being saved.

Will there be the notion of multiple instances of these files (user 1,
user 2, etc.)? Maybe flat files would be better for this.

Will there be only 1 instance that is shared by multiple users? Maybe a
DB would be better.

How will the data be upgraded? How will this be handled - copies of
files/tables or some other method.

Will you need want to keep a "roseta stone" (aka key) to some home
brewed file format? This is something that you will need if you do not
follow some standard format (database, xml, etc). You dont want to open
up a file and have a bunch of garbage in it and have no clue what it is
do you?

Is it a bunch of small values or only 1 or 2 large/huge values (such as
an image)?

Will you need to query this data for a report or something? Databases
are great for this!

Who will be responsible for backing up the data? Your program (maybe
flat files are better) or will your customers IT department handle this
(database server is better maybe)? This is a very important one to keep
in mind since if your program handles user entered data they will want
a backup to be done at some point and if you can push it off on them
then it is one less thing for you to worry about when the system
crashes!

As for what options you have here are a few that I can think of. I am
sure there are others though.
- Database servers (SQL Server, MySQL, etc.)
- Database files (Access, etc.)
- XML
- INI files
- Registry
- Flat text files
- Flat binary files (home brewed files)

What is all comes down to is requirements. Either the ones your
customer imposes on you, or the ones that your application imposes on
your customer. You cannot support everything in every application... or
can you? :-)

Hope this helps!
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
> I'd like to get some feedback on the issue of storing data out to disk
> and where to store it. I've never been in a production environment in
> programming so you'll have to bear with me...
>
> My question is about storing data in a database. Yes I understand
> that you can link to a database in your program and read and write to
> the database etc etc. Well, that's all find and dandy but what if the
> person you're writing the application for doesn't have SQL/Access or
> some other database provider to use? Does Microsoft provide a class
> library to make disk/data storage simpler without having to write
> individual pieces of data out to disk? I've done a bit of searching
> through the MSDN online documentation using Serialization, marking
> code as serializable, and then writing it out to disk...and actually
> got it to work...but is this efficient or does MS have another way
> that's simpler? I'd just like some feedback if anyone has the time...
>
> Thanks,
>
> Chris
>
> --
> Securing your systems is much like fighting off disease -- as long as
> you maintain basic hygiene, you're likely to be okay, but you'll never
> be invulnerable.
>
> Steve Shah - Unix Systems Network Administrator
>



Dec 20 '05 #7

P: n/a
Keep in mind that you can attach a database file (like access or
whatever) and the end user does not need that type of server installed,
you can just use the System.Data.OleDb, etc classes to work with that
database file.

If the database isn't going to be HUGE and only one program/user will be
working with it at a time, then you can just do everything using a
dataset and read/write to an xml file.

Chris Springer wrote:
I'd like to get some feedback on the issue of storing data out to disk and
where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that you
can link to a database in your program and read and write to the database
etc etc. Well, that's all find and dandy but what if the person you're
writing the application for doesn't have SQL/Access or some other database
provider to use? Does Microsoft provide a class library to make disk/data
storage simpler without having to write individual pieces of data out to
disk? I've done a bit of searching through the MSDN online documentation
using Serialization, marking code as serializable, and then writing it out
to disk...and actually got it to work...but is this efficient or does MS
have another way that's simpler? I'd just like some feedback if anyone has
the time...

Thanks,

Chris

Dec 20 '05 #8

P: n/a
Chris Springer <cs*****@adelphia.net> wrote:
Well what I've been trying to do is come up with a program for a local
church that has a donation/redistribution program for used furniture. They
want a small application that can take the place of their current paper
system to make it more cost effective and a bit more efficient and
up-to-date overall. Setting their motives aside, I've designed the entire
interface, gotten their approval, and am now moving on to writing the data
out to disk. My original idea was to create an Access database file for
storage of records to make for really easy data access and searching
capabilities. My problem now becomes...how do I do this in C#? What if
they don't have MS Access? Can I still have the application create an
access database on their machine? What built in .NET framework classes
handle working with Access databases? I did have some direction in which I
was heading but I'm stumped as to how to create the Access file on the fly
and get the data to and from that file. Thanks for the responses I've
received already...I do appreciate any other input that you have.


I'd second the recommendation to use SQL 2005 Express. Even if they
don't already have it, they can install and use it for free, and you
can even redistribute it yourself.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 20 '05 #9

P: n/a
I'm thinking that the OLE DB option to include a file without having any
attachment to a server is the option I'm looking for. I really don't like
the idea of having to tell them that they need to install this or that just
to run the application (referring to SQL server 2005). Does anyone have a
suggestion for a comprehensive overview of the OLE DB class library? I've
browsed the online materials that came with MSVS but I think I need to see
some simple examples of getting data from a database file so I can
understand it a little better.

Thanks for all the help,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Benny Raymond" <be***@pocketrocks.com> wrote in message
news:e%***************@TK2MSFTNGP15.phx.gbl...
Keep in mind that you can attach a database file (like access or whatever)
and the end user does not need that type of server installed, you can just
use the System.Data.OleDb, etc classes to work with that database file.

If the database isn't going to be HUGE and only one program/user will be
working with it at a time, then you can just do everything using a dataset
and read/write to an xml file.

Chris Springer wrote:
I'd like to get some feedback on the issue of storing data out to disk
and where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the person
you're writing the application for doesn't have SQL/Access or some other
database provider to use? Does Microsoft provide a class library to make
disk/data storage simpler without having to write individual pieces of
data out to disk? I've done a bit of searching through the MSDN online
documentation using Serialization, marking code as serializable, and then
writing it out to disk...and actually got it to work...but is this
efficient or does MS have another way that's simpler? I'd just like some
feedback if anyone has the time...

Thanks,

Chris

Dec 21 '05 #10

P: n/a
Ok, I feel like an idiot for this but I'm this whole thread is pretty much
useless now that I've been doing some digging in MS's online documentation.
I didn't realize that VS had a built-in visual designer for datasets also!
Man, is there anything they didn't include in this thing? I only have one
more question about this though...

I've done the walkthrough for creating datasets visually (very simple and
great for the "Access literate") so how can I now import my Access database
and view it as a dataset? Do I need to fill a dataset through a data
adapter and then write out the XmlSchema and reimport that into my
application? Is there a simpler way to do this? Thanks for all the
responses!

Best Regards,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk and
where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the person
you're writing the application for doesn't have SQL/Access or some other
database provider to use? Does Microsoft provide a class library to make
disk/data storage simpler without having to write individual pieces of
data out to disk? I've done a bit of searching through the MSDN online
documentation using Serialization, marking code as serializable, and then
writing it out to disk...and actually got it to work...but is this
efficient or does MS have another way that's simpler? I'd just like some
feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator

Dec 21 '05 #11

P: n/a
Well, I've managed to answer my own question in about 5 seconds of going
back and trying to drag and drop from server explorer to the dataset
designer. Microsoft has really outdone themselves this time...very nice!

Thanks all for putting up with my newbness,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:Kq******************************@adelphia.com ...
Ok, I feel like an idiot for this but I'm this whole thread is pretty much
useless now that I've been doing some digging in MS's online
documentation. I didn't realize that VS had a built-in visual designer for
datasets also! Man, is there anything they didn't include in this thing?
I only have one more question about this though...

I've done the walkthrough for creating datasets visually (very simple and
great for the "Access literate") so how can I now import my Access
database and view it as a dataset? Do I need to fill a dataset through a
data adapter and then write out the XmlSchema and reimport that into my
application? Is there a simpler way to do this? Thanks for all the
responses!

Best Regards,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator
"Chris Springer" <cs*****@adelphia.net> wrote in message
news:m7********************@adelphia.com...
I'd like to get some feedback on the issue of storing data out to disk
and where to store it. I've never been in a production environment in
programming so you'll have to bear with me...

My question is about storing data in a database. Yes I understand that
you can link to a database in your program and read and write to the
database etc etc. Well, that's all find and dandy but what if the person
you're writing the application for doesn't have SQL/Access or some other
database provider to use? Does Microsoft provide a class library to make
disk/data storage simpler without having to write individual pieces of
data out to disk? I've done a bit of searching through the MSDN online
documentation using Serialization, marking code as serializable, and then
writing it out to disk...and actually got it to work...but is this
efficient or does MS have another way that's simpler? I'd just like some
feedback if anyone has the time...

Thanks,

Chris

--
Securing your systems is much like fighting off disease -- as long as you
maintain basic hygiene, you're likely to be okay, but you'll never be
invulnerable.

Steve Shah - Unix Systems Network Administrator


Dec 21 '05 #12

P: n/a
KJ
Here is a partial example, that shows how to load a comma-delimited
file (whose first row contains the column names) into a dataset:

First, create a schema file called schema.ini in the same directory
where the csv file will reside, using a method such as:

private static void WriteSchemaFile(string schemaFileName, string
manifestFileName)
{
if (File.Exists(schemaFileName))
File.Delete(schemaFileName);

StreamWriter sw = File.CreateText(schemaFileName);
sw.WriteLine("[" + manifestFileName + "]");
sw.WriteLine("ColNameHeader=True");
sw.WriteLine("Format=TabDelimited");
sw.WriteLine("CharacterSet=ANSI");
sw.Close();
}

Next, populate your csv file, making sure that the first row contain
the column headers.

Finally, you may read from the csv into a dataset, if desired, for
example:

//manifestFileName is a string variable that holds the full path to
your csv file

DataSet ds = new DataSet("VehicleEntries");
string connStr =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
Path.GetDirectoryName(manifestFileName) +
";Extended Properties='Text;HDR=No;FMT=Delimited'";

OleDbConnection conn = new OleDbConnection(connStr);
OleDbDataAdapter da = new OleDbDataAdapter(
"SELECT * FROM " +
Path.GetFileName(manifestFileName) +
" as Entry ORDER BY VehicleMake, VehicleModel, VehicleYear", conn);

da.Fill(ds, "VehicleEntry");

I may have left something out here, since this is cut and pasted from
real code. Let me know.

Dec 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.