473,388 Members | 1,234 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Best storage method

HI, I have two sets of data, the largest set of data contains 370 rows...
both sets only have two columns. I want to be able to distribute the data
with my applaction. The other option, would be to have the data as seprate
file(easier if needs updating), but I don't what the user to be able to read
the file, just my program should be able to read the file.
Any ideas on the best method?
thanks,
Brian
Oct 15 '08 #1
4 2004
"Brian" <bs********@community.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
HI, I have two sets of data, the largest set of data contains 370 rows...
both sets only have two columns. I want to be able to distribute the data
with my applaction. The other option, would be to have the data as
seprate file(easier if needs updating), but I don't what the user to be
able to read the file, just my program should be able to read the file.
Any ideas on the best method?
thanks,
Brian
Have you thought about encrypting the data in the file?
Oct 15 '08 #2
If you want to persist the state of a DataSet to your application at a later
time, I'd look up binary serialization. It will save your dataset to a file
in binary format (unreadable by people) You can Google "VB.NET binary
serialization" but the jist of it is:

Dim objDS As DataSet = New DataSet()
' Populate dataset

Dim S As Stream = File.Open("MyDS.bin", FileMode.Create,
FileAccess.ReadWrite)
Dim BF As BinaryFormatter = New BinaryFormatter()
BF.Serialize(S, objDS)
S.Close()

When you deserialize it, you'll have your dataset back in the same state you
left it. If your data is sensitive, I'd encrypt it first because any program
will be able to deserialize your object back into a dataset.

"Brian" <bs********@community.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
HI, I have two sets of data, the largest set of data contains 370 rows...
both sets only have two columns. I want to be able to distribute the data
with my applaction. The other option, would be to have the data as
seprate file(easier if needs updating), but I don't what the user to be
able to read the file, just my program should be able to read the file.
Any ideas on the best method?
thanks,
Brian
Oct 19 '08 #3
Thanks, works pretty good.
i was trying this with just a few simple textboxes... then I thought I'd try
to encrypt it.
I was thinking the best way to do this was to encryp the string before the
binaryformatter, but i dont't a difference in the find between encrypted and
standard text.
i was reading through and using the example at
http://www.devarticles.com/c/a/VB.Ne...-Basic-.NET/3/
but instead of creating a memory stream, I passed byval the filestream.
Is it best to encrypt the binary or the string? Not sure, and have not
tried to, encrypt the binary and that really does not make much since to me.
Any possibly helpful thoughts
Brian
"Scott Stark" <em***@scottstark.comwrote in message
news:OK**************@TK2MSFTNGP05.phx.gbl...
If you want to persist the state of a DataSet to your application at a
later time, I'd look up binary serialization. It will save your dataset to
a file in binary format (unreadable by people) You can Google "VB.NET
binary serialization" but the jist of it is:

Dim objDS As DataSet = New DataSet()
' Populate dataset

Dim S As Stream = File.Open("MyDS.bin", FileMode.Create,
FileAccess.ReadWrite)
Dim BF As BinaryFormatter = New BinaryFormatter()
BF.Serialize(S, objDS)
S.Close()

When you deserialize it, you'll have your dataset back in the same state
you left it. If your data is sensitive, I'd encrypt it first because any
program will be able to deserialize your object back into a dataset.

"Brian" <bs********@community.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>HI, I have two sets of data, the largest set of data contains 370
rows... both sets only have two columns. I want to be able to distribute
the data with my applaction. The other option, would be to have the data
as seprate file(easier if needs updating), but I don't what the user to
be able to read the file, just my program should be able to read the
file.
Any ideas on the best method?
thanks,
Brian

Oct 20 '08 #4
I think the best approach would be to serialize the DataSet to XML in memory
(in other words, convert your dataset into a string) and then encrypt the
string, THEN serialize the encrypted string into a binary format. It would
look something like this (note, I'm just hammering this out ad hoc, I
haven't tested it):

Private Sub EncryptDataSet(DS As DataSet)
Dim XMLData As StringBuilder = New StringBuilder()
Dim Writer As StringWriter = New StringWriter(XMLData)

DS.WriteXML(writer)

' You'll need to write the EncryptString function to do the actual
encryption
Dim EncryptedData As String = EncryptString(strKey, XMLData.ToString())

Dim S As Stream = File.Open("MyDS.bin", FileMode.Create,
FileAccess.ReadWrite)
Dim BF As BinaryFormatter = New BinaryFormatter()
BF.Serialize(S, EncryptedDate)
S.Close()
End Sub

Decrypting it would just be the reverse. Deserialize the file into memory,
decrypt the string, load it into a DataSet using the DataSet.ReadXml method
and you've got your DataSet back.

"Brian" <bs********@community.nospamwrote in message
news:uj**************@TK2MSFTNGP03.phx.gbl...
Thanks, works pretty good.
i was trying this with just a few simple textboxes... then I thought I'd
try to encrypt it.
I was thinking the best way to do this was to encryp the string before the
binaryformatter, but i dont't a difference in the find between encrypted
and standard text.
i was reading through and using the example at
http://www.devarticles.com/c/a/VB.Ne...-Basic-.NET/3/
but instead of creating a memory stream, I passed byval the filestream.
Is it best to encrypt the binary or the string? Not sure, and have not
tried to, encrypt the binary and that really does not make much since to
me.
Any possibly helpful thoughts
Brian
"Scott Stark" <em***@scottstark.comwrote in message
news:OK**************@TK2MSFTNGP05.phx.gbl...
>If you want to persist the state of a DataSet to your application at a
later time, I'd look up binary serialization. It will save your dataset
to a file in binary format (unreadable by people) You can Google "VB.NET
binary serialization" but the jist of it is:

Dim objDS As DataSet = New DataSet()
' Populate dataset

Dim S As Stream = File.Open("MyDS.bin", FileMode.Create,
FileAccess.ReadWrite)
Dim BF As BinaryFormatter = New BinaryFormatter()
BF.Serialize(S, objDS)
S.Close()

When you deserialize it, you'll have your dataset back in the same state
you left it. If your data is sensitive, I'd encrypt it first because any
program will be able to deserialize your object back into a dataset.

"Brian" <bs********@community.nospamwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>>HI, I have two sets of data, the largest set of data contains 370
rows... both sets only have two columns. I want to be able to
distribute the data with my applaction. The other option, would be to
have the data as seprate file(easier if needs updating), but I don't
what the user to be able to read the file, just my program should be
able to read the file.
Any ideas on the best method?
thanks,
Brian

Oct 21 '08 #5

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

Similar topics

11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
2
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
9
by: Frances | last post by:
Hi All, * PREMISE * I'm creating an Access form with 150 items subdivided into 20 categories. Multiple categories (and items) can be selected so my user wants checkboxes. All of the options...
7
by: MrNobody | last post by:
I was a Java developer so I'm used to using property files as a means to keep configuration settings for my apps. I'm wondering what options are there with ..NET? Some settings I want to include...
8
by: Art | last post by:
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....
5
by: Tom | last post by:
If I have a container class that has a map member which stores pointers to objects that have been created via the new operator and I have a method that returns a entry in the map, would it be best...
1
by: C#Coder | last post by:
I need to create an Isolated Storage File for my assembly with machine level scope. I have used the 'GetMachineStoreForAssembly' method to do this and this creates the Isolated Storage File...
11
by: john_c | last post by:
I'd like to store information for roles in Session variables. RoleA has a specific set of values, RoleB has a specific set and so one. When I access values for RoleA, it looks like this: ...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.