Compressing A Database To A Single File?

Jun 4, 2010

In my contact manager program I have been storing information by reading and writing comma delimited files for each individual contact, and storing notes in a file for each note, and I'm wondering how I could go about shrinking them all into one file effectively. I have attempted using data entry tools in the visual studio toolbox and template class, though I have never quite figured out how to use them. What would be especially convenient is if I could store data as data type IOwner (a class I created) as opposed to strings.

I'd also need to figure out how to tell the program what to do when a file is opened (I've noticed in the properties how to associate a file type with the program though am not sure how to tell it what to do when it's opened).

Edit:

How about rephrasing the question: I have a class IContact with various properties some of them being lists of other class objects. I have a public list of IContact. Can I write Contacts as List(Of IContact) to a file as opposed to a bunch of strings?

Second part of the question: I have associated .cms files with my program. But if a user opens the file, what code should the program run through in an attempt to deal with the file? This file is going to contain data that the program needs to read, how do I tell it to read a file when the program is opened vicariously because the file was opened?

View 2 Replies


ADVERTISEMENT

Compressing RTF For Database

Aug 22, 2011

I am developing an application where the user saves a chosen RTF file to a SQL Server database. My problem is that if the file contains an image, the binary becomes too big. Although the database has enough space, it's not very nice to use up space you could save.... To give an example:

[Code]...

View 2 Replies

Compressing RTF For Database?

Aug 22, 2011

I am developing an application where the user saves a chosen RTF file to a SQL Server database. My problem is that if the file contains an image, the binary becomes too big. Although the database has enough space, it's not very nice to use up space you could save....To give an example:

RTF binary with two text lines ("ABC / efg") = 156 Bytes
Same 2 lines + 32 kB image = 2.2MB

I am still confused on which is the best way to solve this. I have thought about creating an "images" table in my database and using a markup to fetch the image when the file is loaded.

View 8 Replies

Compressing A Stream Rather Than A File?

Apr 3, 2010

I've downloaded ZLIB.NET from here and the example VB.NET code they provide works fine. It's very short so I'll paste it here for reference:

vb
Public Shared Sub CopyStream(ByRef input As System.IO.Stream, ByRef output As System.IO.Stream)
Dim num1 As Integer

[Code]...

Note that the CopyStream() subroutine is identical. The problem is that although decompressing seems to work fine, compressing does not. If I take a byte stream, compress it and then decompress it using the above code, I get a truncated version of the original stream (as an example, a 360485 byte stream becomes 311518 bytes). The resulting bytes match the original stream up until the point where it's cut off.

The only information I can find about streams being truncated is due to missing stream.Flush() commands but the output stream is flushed in the CopyStream() subroutine.

View 5 Replies

Update A Single Row And A Single Cell In Ms Access Database?

Dec 3, 2010

I am trying to update a row or a single cell in ms access through vb.net. But when i update the text box named NRIC, say for example i want to update "s4522147B" to "tr4521856C" and mean while leaving the other fields the same.

But the thing is when i make the changes in nric.text (textbox), the dataset actually updates the whole column in the table instead of the selected textbox.

Below is my code for the update part

[Code].....

View 3 Replies

C# - Worth Compressing The ViewState?

Nov 16, 2010

I agree that the best way to shorten the ViewState is to disable it on the ASP.Net controls that don't need it. Keeping it small from the beginning is a great habit.I have also heard that it is already compressed (although can be true... there are ways of compressing it even more, has described in this Stack Overflow question).

My question here is not if it should be compressed... is: when should ViewState be compressed?If we have a ViewState of 410 characters it will weight 410 bytes in a page, while a ViewState of 13.843 characters equals 13.5 KB.

13.5KB is a considerable weight already. And if I compress a CSS file that height 10KB, I think it is also worthy compressing a ViewState of 13.5KB, even if that means a little extra "thinking" on the server.

But is 410 bytes of ViewState worth the extra processing on the server?At what point is it worth compressing?

View 2 Replies

CGZIPLibrary.dll Not Compressing Files?

May 27, 2011

I am using CGZipLibrary.dll in my code for zipping the files. A .zip file is being created but the file is not getting compressed. The original file and the .zip file are of same size.

View 1 Replies

Compressing Memory Streams?

Jun 24, 2009

I have this code for compressing datasets into files:

Using fs As New System.IO.FileStream(flnm, IO.FileMode.OpenOrCreate, IO.FileAccess.Write, IO.FileShare.Write)
Using zStrm As New System.IO.Compression.GZipStream(fs,

[code].....

View 1 Replies

Compressing Multiple Sub Folders?

Oct 26, 2011

I've written a backup utility for one of our applications; this process involves coping sub directories of a specified base folder and an unknown number of folders within folders. I've got the process down to copy the files and directories pretty easily but I want to compress the folder structure to keep the space needed as small as possible.I've found a few utilities that work well for getting the files from the specified base folder but not any of the folders that exist in the specified start directory.The one utility I found required me to recursively search directories for the variably named directories and I am hoping for a simple switch that can be used that says base folder/file and sub directories.

View 1 Replies

Compressing Sql Server Data Across Vpn?

Aug 16, 2009

compressing sql server data (on the fly) from a select statement when accessed across the internet. i.e data is stored in Sql Server Express on a remote computer (1) connected via an Internet VPN. An application on a remote computer (2) on the same VPN sends a select statement to the SQL server machine.The data would then be compressed at computer (1) sent across the VPN and decompressed at computer (2)

The Reason is, broadband speeds are not the greatest in Australia, and it would reduce the size of the data transmitted, resulting in faster response, as the compression/decompression is done at each machine

View 1 Replies

Compressing Normal Files Into A EXE Created By VB?

Apr 2, 2009

I am need of creating a windows executable that contains a compression of certain other binary files, (executables etc)

It is a basic form with a button, on press of the button, it has to decompress certain binary files( some other executables too) into a certain path, the decompression happens based on some specific conditions and not always., This is the reason I could not use WinZIP to create the EXE.

View 3 Replies

Storing Files Into An Application Compressing Them And Then Extracting Them?

Apr 8, 2009

How could I go about doing this if I can? Storing files into an application compressing them and then extracting them?

View 1 Replies

VS 2008 Compressing / Decompressing Entire Folders

Apr 1, 2010

How do you do it? I've looked it up everywhere and failed to find anything. If there is a previous post I missed that discussed this, post it as a comment and forgive me. <scenerio>Friend and I are working on a VB project. We want to export and inport folders of information, and to do so neatly, we wanted to compress the files in the format we made for our program, then be able to decompress it within the program as well. If theres any other way to do this without compression and decompression

View 2 Replies

VS 2005 - Compressing A Dataset Converted To XML Using The GZipStream Class Added In 2.0

Mar 25, 2009

I am compressing a dataset converted to XML using the GZipStream class added in 2.0. There are a few things bothering me about this. Here's the code I am using to decompress the XML file:

Using inFile As New System.IO.FileStream(flnm, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
Dim zStrm As New System.IO.Compression.GZipStream(inFile, IO.Compression.CompressionMode.Decompress)
Dim buff(999) As Byte

[CODE]...

This seems inordinately awkward, as I am taking the stream, reading it out into byte buffers, then writing those byte buffers to a memory stream that is then passed to the dataset.ReadXml() method. The reason for this seems to have to do with what is happening in the line colored red. That line is adding a closing > onto the end of the stream. Without that, ReadXml complains about an unclosed dataset. I found out that the > was missing by writing the stream into a string and pasting the string into WordPad. Without that missing >, it appears that I wouldn't need to be using that memory stream at all, and could simply pass in the GZipStream to ReadXML, but as far as I can tell, it's impossible to look at the GZipStream to be sure that the > is not there, and it may be impossible to add it (I haven't tried).

So why is the > missing? Here's the code used to create the file that is being read into the filestream in the above

VB Using ms As New System.IO.FileStream(flnm, IO.FileMode.OpenOrCreate, IO.FileAccess.Write, IO.FileShare.Write)
Dim zStrm As New System.IO.Compression.GZipStream(ms, IO.Compression.CompressionMode.Compress)

ds.WriteXml(zStrm, XmlWriteMode.WriteSchema)
End Using

The real kicker to all of this is that while I was dissecting the first chunk of code, I added a line to check for cnt<1000. My intention was to see the last buffer that was being written into the memory stream to see whether the final > was actually there, or not. To my surprise, I reached the cnt<1000 twice. That means that one read did not read a full 1000 bytes, but read only 675. The next three or four reads were a full 1000 bytes, then the final read was just a few hundred bytes. It is my understanding that Read will return a full buffer if there are that many bytes left to read, and there were, so why did it return only a partial buffer? That suggests that there might be a hole in my XML, though with a half meg file, it's a bit much to read through it looking for something missing. However, the XML that was returned was turned into a dataset that I then merged into some existing data using code that has been working with uncompressed XML files, and I got an error that I should never have received. That may indicate that the XML was, in fact, missing something, though I will have to study the matter further to figure out whether or not that is the case. My major question has to do with the missing '>' at the very end of the file.

View 2 Replies

Getting Out A Single Value From A Sql Database (asp.net)

Apr 1, 2011

I'm trying to get a single value from my table in a database. They are all given a unique id when stored. Here is the code I use to put the in:

[Code]....

That was so you could get an idea of what I was looking for, I'm not looking for sql statements, I don't know how to use them. Just keep in mind, this is all vb.net/asp.net.

[Code]....

View 1 Replies

SQL Server - Possible To Get Single Value From Database?

Oct 27, 2011

Looking for the simplest way to get a single value from a database. This gets confusing when you consider all of the 9,000 ways that exist to do this in a .NET language. SqlCommands, DataReaders, Recordsets... Assume I already have a connection to the DB opened. I simply want to do something like this:
Dim age As Integer = <SQL statement here>

View 2 Replies

Add More Than A Single Photo To Database (one Cell)?

Nov 4, 2011

I'm creating a database for photos'.

The issue is that I have a need to upload a set of photos to the database instead of a single photo.

This would be all fine and dandy if I knew how many photos would be added at once but in this case it could be 1 or 100.

I have my database (setup in details) and dragged onto my form. Right now I only have a picture box for my picture to place into the database.

So what's the best way to upload numerous photos to a database without having to create 10000 cells in my database?

View 3 Replies

Editing A Single Field Of A Database?

Mar 9, 2010

with editing a single field of a database. variable dS is my dataset variable in which i have filled with the tables of my database. since its my first time in database management with vb.net

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If txtPOno.Text = "" Or txtDate.Text = "" Or txtSuppCode.Text = "" Or rBOM < 0 Or

[Code].....

inorder to pass. honestly, i really think that im using a BRUTE FORCE method.

View 2 Replies

How To Read Single Result From SQL Database

Jun 19, 2009

I am trying to read a single result from an SQL table. I tested my query in MySQL Query Browser and it returns a result of USER_ID=4. My query:
SELECT USER_ID FROM aaalogin where NAME = 'administrator'
I believe my error is due to some "double quoting". I have a "txtUsername" textbox on my login form. I want to inject the typed entry from this textbox into my SQL QUERY. Notice the end of this line, I have tried tons of combinations, nothing works.
myCommand.CommandText = "SELECT USER_ID FROM aaalogin where NAME = " & " ' txtUsername.Text ' "
The result is ALWAYS "0" though, which is useless to me.

Full code below:
Imports MySql.Data.MySqlClient
Imports System.Data
Public Class frmLogin
Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
Application.Exit()
[Code] .....

View 5 Replies

Perform Two Hashing Operations Concurrently On A Single File Without Reading The File Twice?

May 18, 2011

I want to perform two hashing operations concurrently on a single file, without reading the file twice. Is there some way to share the FileStream between two synchronized hashing threads? For example:

Dim Stream As New IO.FileStream("...", IO.FileMode.Open)
Dim HashA, HashB As Byte()
Dim A = New System.Threading.Thread(Sub()

[code]....

Maybe some way of caching a stream? Trouble is, I don't want the entire file in memory at once (it could be many gigabytes in size) and I don't want the file read more than once, due to speed issues. I want the file cached only sufficiently to ensure that both threads can work.For example, suppose at some point in time, thread A had read 100k of the file, but thread B had only read 20k of the file. The portion of the file between 20k and 100k should be cached; but then progressively forgotten as thread B catches up. Then again, if thread B is too slow, we might still end up with hundreds of megabytes being cached.Maybe thread A should be made to wait while thread B catches up. Maybe the ReadByte() function of the stream should block for a while if one of the threads is too far behind?

View 13 Replies

DB/Reporting :: Updating A Single Field In A Database

Mar 20, 2009

I'm using an access database in a program that I'm making for my school, the user is able to select an item from the menu, then it sends it to a list box, there is also a textbox to put a quantity of how much of the item you want. I have a field in my database called Amout Ordered, I want to update it with the amount of each item ordered, and I can't figure out how.

View 1 Replies

Multiple Applications Updating Single Database?

Feb 19, 2009

I have an application which takes input on a local machine and sends it to a database stored on a server. I'd like to be able to deploy my application over a number of computers (all on the same network), all of them updating the same database (on the network server).First of all, will this be possible without putting together a completely new application to handle all connections to the database and sorting the entries?

View 7 Replies

Sql Server - Single User After Renaming An MS-SQL Database?

Oct 16, 2009

I am using help of SqlServer.Management.Smo to rename an attached MS-SQL database.

Dim db As New Database = ActiveSQLServer.Databases(OLD_NAME)
db.ExecuteNonQuery("ALTER DATABASE " & OLD_NAME & " SET SINGLE_USER WITH ROLLBACK IMMEDIATE")
db.ExecuteNonQuery("ALTER DATABASE " & OLD_NAME & " MODIFY NAME = " & NEW_NAME)

The problem is that after renaming the database is set as a Single User.So what am i doing wrong?

View 1 Replies

Update A Single Cell Of A Database Table?

Jan 5, 2012

I am using MS Access Database. Now I have to update a particular cell value. Here is my code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim str As String
Dim Presc As New System.Text.StringBuilder
Dim prs As String(), j As Integer

[Code]....

This code updates all the cells in that column. I want to update only the particular cell having Case_ID = str Where I have to add the WHERE clause (WHERE Case_ID = " & str & "

View 2 Replies

Make Application 'single File' And Get Rid Of XML Config File?

Dec 29, 2010

I have this pretty simple application, it uses a webService to transfer data to my servers DataBase. Now it is very important for me to keep this application as one single file, and not having some XML files needed for it to work, but this is the case. I think the XML file holds the information to this webService, so without it the application crashes. Is there a way to get the application to work without this XML file, or a way to put the XML inside the exe archive?

View 1 Replies

Inserting Multiple Records In Database Using Single Query?

Apr 11, 2011

I am using vb.net and sqlite as database. I am using below scenario to insert multiple records in database using a single query.

INSERT INTO TableName (FirstCol, SecondCol)
SELECT 'First' ,1
UNION ALL
SELECT 'Second' ,2
UNION ALL
SELECT 'Third' ,3
[Code] .....

For less records it is working very well.But when I am inserting about 800 records at a time, executenonquery is throwing the following exception:
SQLite error
Too many terms in compound SELECT.

View 7 Replies

Matching One Field Of A Database With Single Entry In Listbox?

Jun 9, 2011

i connect database with vb.net and also i receive a single value from my receiver through serial port. now i want to match this single data with one field of database. i have attached my code.

Public Class Form1
Private Sub OPEN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code].....

View 1 Replies

RTF & TEXT - Combine Some Data Into A RTB From A Database Into A Single RTB With Formatting

Aug 10, 2011

I am trying to combine some data into a RTB from a Database into a single RTB with formatting. Let me try and explain... In my Database I have some Fields that Contain RichText (formatted) and Some that are only Text (nvarchar) and I need to combine these into one RTB with formatting.

[Code]...

View 1 Replies

Sqldatasource Control - Read A Single Value From A Sql Server Database ?

Jul 17, 2011

Trying to use asp.net for the first time. I want to read a single value from a sql server database.

I have configured the SqldataSource as:

CODE:

I have the above asp:SqlDataSource code on the website page. The connection string is in the web.config file. When I run the page it is all works but the required data is not shown. Am I right to think that where I dragged the sqldatasource entity is where the data result should be shown?

View 1 Replies

Update A Single Field In A Row In A Database By Clicking A Button?

Jul 16, 2009

I have two buttons on a form , clock in and clock out, and i have two fields in an access database, fldCheckIn and fldCheckOut, when i click the check in button i want it to get the current time and set it to the field in the database

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved