473,466 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Writing data to disk?!

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
12 3725
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
8
by: Lu | last post by:
Hi there, I got a program to write data to a randomly accessed file (the program moves file pointer to a certain position of the file according the current "keyword" and then writes data). It...
4
by: Igor Shulgin | last post by:
Hi! What is standard and direct way (within Oracle 9.2 stored procedures) for writing binary data from Oracle to external file on disk? We have tried to use UTL_FILE package, but it operates on...
5
by: Ben Jeurissen | last post by:
Hello, I have to deal with the following issue in C++: Two threads are started from the main thread, both capturing images from a different firewire camera. Both threads take shots of 460800...
3
by: ishekar | last post by:
Hi, I have an application where i want to write data to a file, the data is being sent from an external source. I know the total size of the data and then i retrieve the data in small segments...
2
by: Jeevan | last post by:
Hi, I have an array of data (which I am getting from a socket connection). I am working on a program which acts on this data but the program is written to work on data from a file (not from an...
16
by: Ali | last post by:
Hi I want to write (or read) to a stream, but the data is not byte array I converted the data to byte array manually, but it is very slow, (becuse the data is very large) Is another way for this...
16
by: Claudio Grondi | last post by:
I have a 250 Gbyte file (occupies the whole hard drive space) and want to change only eight bytes in this file at a given offset of appr. 200 Gbyte (all other data in that file should remain...
13
by: Sebouh | last post by:
Hi guys. I am messing around with virtual file systems lately, but i have a problem. I want to save a structure on the virtual disk as raw data. How can i do this? Should i convert each "member"...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.