473,783 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best practice for saving user data?

Art
Hi folks,

I'm writing a traditional desktop app using VB.NET and am stumbling
over what seems like a very basic question:

My app does not need to be connected to a server or another computer.
It just runs locally. So what is the best way to store user-entered
data? The app is like an address book, where users can enter contacts
and save the data.

I come from a web background, and so would be perfectly happy using
ADO.net to save the data to a local instance of Access or XML, etc.,
but I suspect that this is overkill and will require too much overhead
for my modest needs.

Should I just stream the data out to a txt file? Binary file?

I've been searching for a best-practices discussion of this using .Net
and am coming up dry (I'm sure I'm just not looking in the right
place!)

Thanks very much!

Art
Nov 20 '05 #1
8 3771
Hi Art,

The best way is in my opinion MSDE, a mini SQL server, however when you want
to deploy you can use MS Access, which you can easy create in your programs
(altough you need a piece of ADO code). When you need the last reply to this
newsgroup.

And easy help although huge is the resource kit.

VB.net Resource kit
http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing the resource kit
http://msdn.microsoft.com/vbasic/vbr...q/#installvdir

Cor
Nov 20 '05 #2
Personally I would use a struct and then toss the struct into a bin file. It
sounds like you have structured data that would be a match for this type of
operation.

Just my own little opinion.
Thom

"Art" <ma*****@gmail. com> wrote in message
news:9e******** *************** ***@posting.goo gle.com...
Hi folks,

I'm writing a traditional desktop app using VB.NET and am stumbling
over what seems like a very basic question:

My app does not need to be connected to a server or another computer.
It just runs locally. So what is the best way to store user-entered
data? The app is like an address book, where users can enter contacts
and save the data.

I come from a web background, and so would be perfectly happy using
ADO.net to save the data to a local instance of Access or XML, etc.,
but I suspect that this is overkill and will require too much overhead
for my modest needs.

Should I just stream the data out to a txt file? Binary file?

I've been searching for a best-practices discussion of this using .Net
and am coming up dry (I'm sure I'm just not looking in the right
place!)

Thanks very much!

Art

Nov 20 '05 #3
* "Thom" <tj******@chart er.net> scripsit:
Personally I would use a struct and then toss the struct into a bin file. It
sounds like you have structured data that would be a match for this type of
operation.


The choice IMO depends on if the data should be "human readable". A
binary format isn't the best way if the user should still be able to
exit the file in a text editor. In this case, XML would be more
appropriate. Using a dataset and storing it as XML file is one way to
do that.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
Hi all,

Thanks for the suggestions--very helpful!

I've been tending to want to stay away from MSDE (although I love it!)
just because I'm not sure that my users will have it installed, and I
don't want to deal with installing it for them (this software will be
available to a wide range of users and systems). Also, I'm concerned
about the resources it might use. If I was deploying to a corporate
environment, I'd do it in a second, though!

I'm not at all concerned that the file be human-readable, so perhaps a
struct in a bin file is the way to go. I'll look also at XML, although
I'm concerned a bit about how large an XML file can get--it'd be nice to
keep the data files lean if I can. Still, I like the idea of using a
dataset--that's something I've at least got experience with.

Thanks again everyone!

Art

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
I would seriously consider a microsoft access database. This makes it very easy to you to allow the user to sort, select by criteria, etc. and the Access database engine is automatically added to the bin directory for distribution.
--
Dennis in Houston
"Art Wait" wrote:
Hi all,

Thanks for the suggestions--very helpful!

I've been tending to want to stay away from MSDE (although I love it!)
just because I'm not sure that my users will have it installed, and I
don't want to deal with installing it for them (this software will be
available to a wide range of users and systems). Also, I'm concerned
about the resources it might use. If I was deploying to a corporate
environment, I'd do it in a second, though!

I'm not at all concerned that the file be human-readable, so perhaps a
struct in a bin file is the way to go. I'll look also at XML, although
I'm concerned a bit about how large an XML file can get--it'd be nice to
keep the data files lean if I can. Still, I like the idea of using a
dataset--that's something I've at least got experience with.

Thanks again everyone!

Art

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #6
Art,
First I would decide which Domain Logic Pattern fit my application the best.
Then based on the Domain Logic Pattern I would consider data storage (RDBMS
(Access, SQL Server, Oracle, AS/400), XML file, binary serialization, other)
and select a Data Source Architectural Pattern. Sometimes the data storage
drives the Domain Logic Pattern.

For information on Domain Logic & Data Source Architectural Patterns see
Martin Fowler's book "Patterns of Enterprise Application Architecture" from
Addison Wesley.
http://www.martinfowler.com/books.html#eaa

http://www.martinfowler.com/eaaCatalog/
I don't have any good links on data storage considerations. If there were no
specific RDBMS requirements or specific XML requirements I favor binary
serialization!
Martin Fowler's book explains when you may want to use a traditional Domain
Model & Data Mapper pattern:
http://www.martinfowler.com/eaaCatalog/domainModel.html
http://www.martinfowler.com/eaaCatalog/dataMapper.html

verses a Table Module & Data Gateway patterns:
http://www.martinfowler.com/eaaCatalog/tableModule.html
http://www.martinfowler.com/eaaCatal...taGateway.html

Martin also offers a couple of other useful patterns that can be used
instead of or in conjunction with the above patterns.

The System.Data.Dat aTable is an implementation of a Record Set pattern:
http://www.martinfowler.com/eaaCatalog/recordSet.html

Rockford Lhotka's book "Expert One-on-One Visual Basic .NET Business
Objects" from A! Press provides a pre-implemented variation of Fowler's
Domain Model & Data Mapper patterns.
http://www.lhotka.net/

Generally if there is no real logic behind my domain objects, I would use
the DataSet OOM coupled with a Table Module & Data Gateway patterns. As the
classes themselves are not really living up to their potential! :-) The
Table Module & Data Gateway patterns may be implemented in a single class or
two classes. Again I would consider using a Typed DataSet.

However if there is significant logic behind my domain objects, I would then
favor the Domain Model & Data Mapper patterns.

Depending on the needs of the project I would consider Fowler's other
patterns...

Hope this helps
Jay
"Art" <ma*****@gmail. com> wrote in message
news:9e******** *************** ***@posting.goo gle.com...
Hi folks,

I'm writing a traditional desktop app using VB.NET and am stumbling
over what seems like a very basic question:

My app does not need to be connected to a server or another computer.
It just runs locally. So what is the best way to store user-entered
data? The app is like an address book, where users can enter contacts
and save the data.

I come from a web background, and so would be perfectly happy using
ADO.net to save the data to a local instance of Access or XML, etc.,
but I suspect that this is overkill and will require too much overhead
for my modest needs.

Should I just stream the data out to a txt file? Binary file?

I've been searching for a best-practices discussion of this using .Net
and am coming up dry (I'm sure I'm just not looking in the right
place!)

Thanks very much!

Art

Nov 20 '05 #7
Art
Thanks, Dennis!

Several others have mentioned using an MDB file as a backend. I didn't
realize, though, that the engine would be automatically included with my
bin--is this freely redistributable ? In other words, would I be able to run
this solution on the computers of people who don't own Access?

Also, how does this compare to the other options mentioned (filestream,
MSDE, etc.) in terms of overhead and speed?

I'll, of course, look for more info on google, but I'd certainly appreciate
any additional thoughts you might have.

Thanks so much!

Art

"Dennis" <De****@discuss ions.microsoft. com>
I would seriously consider a microsoft access database. This makes it very easy to you to allow the user to sort, select by criteria, etc. and the
Access database engine is automatically added to the bin directory for
distribution. --
Dennis in Houston

Nov 20 '05 #8
Art,

1. It is freely distributable.

2. It is fairly quick for small to medium sized databases, with under
50,000 records in a table. More than that and you should look at MSDE.

3. It has a lot smaller footprint than MSDE.

4. It is an ideal solution if you are only going to be running one
workstation on the database at a time. If you are going to need multple
workstations on the same database at the same time you should probably
consider MSDE.

5. MSDE is also freely distributable. It can be a little tricky getting it
included in your setup project and getting a database attached on the target
machine.

-Sam Matzen
"Art" <ma*****@gmail. com> wrote in message
news:eG******** ******@TK2MSFTN GP12.phx.gbl...
Thanks, Dennis!

Several others have mentioned using an MDB file as a backend. I didn't
realize, though, that the engine would be automatically included with my
bin--is this freely redistributable ? In other words, would I be able to run this solution on the computers of people who don't own Access?

Also, how does this compare to the other options mentioned (filestream,
MSDE, etc.) in terms of overhead and speed?

I'll, of course, look for more info on google, but I'd certainly appreciate any additional thoughts you might have.

Thanks so much!

Art

"Dennis" <De****@discuss ions.microsoft. com>
I would seriously consider a microsoft access database. This makes it very easy to you to allow the user to sort, select by criteria, etc. and

the Access database engine is automatically added to the bin directory for
distribution.
--
Dennis in Houston


Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3105
by: James E | last post by:
I have a question about best practices of how to deal with lookup data from my C# apps. On a couple of occasions I have come across a problem where I have to automate inserting a record into a table that has a foreign key constraint that is linked to a lookup table. E.g. Take the following database structure: SQL-Server Database: Table 1:
2
1264
by: RA | last post by:
Hi I use ASP.net with c#. The web application is hosted by a web host provider. The application gets user information for order processing. The information should be moved from one aspx page to the other until the user choose to submit the order. The order process has about 4 aspx pages. What will be the best way to keep the user data between the pages considering the following: 1) User might not have cookies enabled 2) I have no...
5
1159
by: Corobori | last post by:
I need to make something like this: http://www.corobori.com/sos/picDemartti.jpg That is the 1st time I am doing like this in ASP.NET (did it tons of times in "old" ASP) so I would like to do it the "right way" from the beginning. Data to populate 1A and 1B are from one query, 2A and 2B from another and 3A and 3B from a 3rd query. Each of them will be clickable with a
1
1382
by: Richard Fagen | last post by:
Hi, What are the best practices to filter a datagrid based on user input? For example: I want to display a grid with rows of sales information and allowed the users to specify options (ex: customer and date ranges), then when they click the 'apply filter' button, I want the rows filtered. I've read about methods using a dataview with the rowfilter and sort
2
1729
by: hooterbite | last post by:
I have a simple form. I would like to insert the values from the form into a SQL table. What is the best way to do it? I assume that using a stored procedure is preferable to using the UpdateCommand="Insert into..." When using a stored procedure, is it better to use a SqlDataSource or an ObjectDataSource? Is it better to make it formview and use asp:Parameter or not put it in a formview and use asp:FormParameter, or is there a better way?
5
1396
by: Shlomi | last post by:
Hi, Until now I used the Session("x")="y" method for saving user or customer info throw web pages (differently for each session) like that: Session("UserName")="Bob" My questions: ==========
3
4965
by: Furty | last post by:
Hi, I'm looking for the best practice for creating a generic data validation implementation for my data bound business objects. I currently have a business object base class implementing the following interfaces: IEditableObject, ICloneable, INotifyPropertyChanged, and IDataErrorInfo More specifically, my IDataErrorInfo implementation is like so:
13
3115
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those sorts of clients. Mine are all small businesses whose sites will never reach those sorts of scales. I deal with businesses whose sites get maybe a few hundred visitors per day (some not even that much) and get no more than ten orders per day....
2
2059
by: kelleram | last post by:
I have data that has to be converted to various time zones based on what setting an account has chosen within the database. All of the data is stored in GMT. There is a function which we've built to convert the data, however, the response time when using it in queries is obviously slow. Anyone have a similar situation in the past? If so, how did you solve it? Trying to determine if adding additional fields for the timezone specific values or...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.