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


ADVERTISEMENT

VS 2005 Create Dataset In A Module And Call It In A Class?

Aug 7, 2009

This is my vb6 programme for creating recordset in a module. and call it in class
and form

[Code]...

View 4 Replies

Integer Cannot Be Converted To 'System.Data.DataSet'

Mar 19, 2011

I am trying to insert a small message of 150 characters into the "AdvertisingInfo" database into the "QuickPost" column. Right now there is only one row that will have various columns updated by several forms.I just started to teach myself VB10 and it has taken me 6 hours to get this far. I'm tired of trying today and am going to bed, but I need help trying to figure this out. I keep getting the error: Value of type 'Integer' cannot be converted to 'System.Data.DataSet'.[code]

View 3 Replies

Added A Subform In VB From SQL Dataset?

Nov 8, 2011

I am trying to create a Form that can be filled out in it's entirety without having to bring up other forms. It is considered in access to be a subform. I have one table that includes Injuries and each injury has a specific ID well I have all the information that goes with it updating, except for the "many-to-many relationships"...I one want injury to have more than one treatment type, the problem occurs when I drag the injury table over from my dataset it automatically creates a binding source for it, which only controls the data inside that table. It does not control the data that is related to it such as "treatment type" "body part injured" . There must be a way to have a single Inj

View 5 Replies

Class Being Converted To 1-dimensional Array?

Jun 29, 2011

I am trying to write a class library and I am getting the following error: "Value of type 'WorkMateLib.Login' cannot be converted to '1-dimensional array of WorkMateLib.Login'"

The code of the classes is as follows:

Public Class Logins
Public CurrentUser As Login()
Public Sub New()

[Code]......

View 1 Replies

Listview Cannot Be Converted To Class Object?

May 23, 2012

Having a class that defining ListView in a class, then passing through the methods as an object (listview)

but having error on

Value of type 'System.Windows.Forms.ListView' cannot be converted to 'Proj.MainForm.ReadMsgClass'.

Public Class ReadMsgClass
Public ListView2ReadMsg As ListView
End Class

[Code]...

View 5 Replies

Saving Data Using Added Dataset In Asp.net?

Feb 26, 2012

I have added a dataset from New Item >> DataSet and configured it. I want to add new row to it using

Dim drNewRow as datarow=DataSet1.tblTest.New

but when I press . after DataSet1, IntelliSense does not catch tblTest, rather it gives tblTestRow and tblTestDataTable

How to get DataSet1.tblTest here?

View 1 Replies

Dataset Not Retaining Columns Added To It Vb2008?

Jul 29, 2009

I add columns to my dataset but when start my application again columns are not there

[Code]...

View 4 Replies

Forms :: Login Form With Added Dataset?

Mar 7, 2010

My background is mostly Access VBA and I am having to learn VB.NET. I am trying to recreate an Access 2007 application I wrote into VB.Net. We are looking at using a hosted SQL Server so we do not have to worry about remote offices or replication. I am using VS 2008 and SS2008.My issue is that I need to create a login form in VB that with look at SQL Server DB and return a dataset record matching the username and password. There are many tutorials on here but do not match what I am looking for.I have a stored procedure with 2 parameters (@prmUser and @prmPassword) named spLogin.I need to call the sp and pass the parameters to SQL Server DB and return the complete row of data that is matched from the button_click event on my form.

In Access, I would have a form that would have the returned data and I would reference that information throughout the application by using the 'forms!frmName!txtValue' to populate forms, reports, and fields that would capture the user that created the record. What is the best practice for this?Next when the login credentials are correct then I need another form to open, which is my MDI form, if not correct then msgbox to try again.

View 16 Replies

Redundant Data Are Added While Creating A XML File From DataSet?

Jan 5, 2012

This is resultant Xml File

<Drug_x0020_Type>Marijuana</Drug_x0020_Type>
<Marij_x0020_Type>Test1</Marij_x0020_Type>
<Test1_x0020_Type>Type1</Test1_x0020_Type> <Time_x0020__x002F__x0020_Date_x0020_Recv_x0027_d>11:30</Time_x0020__x002F__x0020_Date_x0020_Recv_x0027_d>

In Database these element are as follows Drug Type,Marij Type, Test1 Type,Time / Recv'd

When i write out the dataset to xml using the GetXml method of the dataset.
Its Created But some extra values are added in element tag.

Its addeding due to special characters like {' / ....etc}

How do i get the resulting xml without those values?

View 1 Replies

.net - Filtering DataGridview Using DataSet -> BindingSource, Extra Columns Later Added?

Apr 29, 2011

For a WinForms VB.Net application, I use the Bindingsource's filtering capacity to filter data, which is seen in a DataGridview. The BindingSource is from a DataSet, created using the Designer, and the data comes from a Access DB, using JetEngine and .Net 3.5. So basically:

Datagridview.Datasource = xxBindingSource
xxBindingsource.Filter = "[extended filter string with multiple columns]"

This filtering works fine, however, now I included some extra columns in the DataGridView, which I'd like to filter on, too. Of course, when I feed the manually added columns to the Filter of the BindingSource, this doesn't work out.I've done some research, and was not able to find any way to use the BindingSource's filtering syntax on the DataGridview. I'd like to use this syntax though, as I designed quite a nice UserControl and class around it, to provide smooth, fast and simple filtering capabilities.

View 1 Replies

Update The Dataset To Reflect An Added Column In The Data Source Without Deleting The Adapter?

Mar 28, 2011

I've made a dataset using the dataset designer, and I'm trying to add a column to reflect changes made to the database (added a column, nothing fancy). Is there a way to 'refresh' the dataset schema from the datasource without deleting my adapter (and all the methods and queries I've created)?

View 2 Replies

C# GZipStream To String?

Aug 12, 2010

I am in need of a way to write a GZipStream to a string.I am using:GZipStream Decompress = new GZipStream(inFile, CompressionMode.Decompress)I have tried several methods, but can't figure it out.

View 1 Replies

Unzip File Using GZipStream?

Mar 24, 2011

How can i unzip file using GZipStream?

View 4 Replies

VS 2005 Typed Dataset Vs UnTyped Dataset

Nov 25, 2009

I want to access data using both the datasets.

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try

[Code]....

In my code i have dataset name ds and table named Info1,when i write ds after that how tablename is coming,its not possible? How to do that ?

View 5 Replies

Added To Each UserControl (different Instances Of The Same Class), A Little Map?

Apr 28, 2009

I have a form whose purpose is to let the user to load map files.The form may manage a variable classes of maps, and each class have his own UserControl.To make it more user friendly, I added to each UserControl (different instances of the same class), a little map, showing a small picture of the map, and some data, as bound coordinates.

The problem is, that it looks really ugly. The maps are so big, compared with the rest of the UserControl (who contains just a button and a textbox to search for files).I wish to fix it, but I din not see an elegant way to include the pictures and info.I attach a form screen capture with two UserControl.I would like to get some tips for more experienced users. There are some guidelines?

View 5 Replies

Asp.net - Added Reference Class Is Still Not Defined?

Oct 28, 2010

I have a web site project where I need to use the System.Security.Cryptography.Xml.SignedXml class. I added the Dll System.Security as a reference and imported the namespace into my project. It compiles successfully but when I debug the project I get a compilation error:

Compiler Error Message: BC30002: Type 'System.Security.Cryptography.Xml.SignedXml' is not defined.

What gives? Edit: I run Windows XP Pro 64bit OS

View 1 Replies

Using Class Function Added As Resource

Jun 7, 2009

I have created a class and I have added it as a resource and imported yet I don't seem to be able to use any of its functions.

View 9 Replies

GZipStream Zip File Password Protect?

Dec 13, 2010

How can i password protect my zip file?

i have the code below i got from the net but the problem is no code to protect file the file

Public Function CompressFile(ByRef file As String, ByRef destination As String) As String
'Make sure user provided a valid file with path

[Code]....

View 2 Replies

VS 2008 : GZipStream Extracts Only 1/4 Of The File?

Mar 9, 2010

This code uncompresses 1/4 of the gzipped file. & I took it directely from the help file sample function codes.Any idea why is it doing this or how to fix it? gz file is attached below & it is not damaged.Edit: I read some stuff hire & there & found this: tutorial that says that MSDN doesn�t set the size of the array and uses a default size of 4086 bytes. But I have no clue how to implement it into my code.In this gz file there are only around 50 lines but there are files with over 1000 lines. So I tested & indeed this seems to be the problem, because if I increase the buffer(4096) more lines are extracted.

PHP
Imports System
Imports System.Collections.Generic
Imports System.IO

[code].....

View 3 Replies

.net - Derived Class Members Not Available When Added To Custom Collectionbase?

Apr 28, 2009

I have a Base Class, called primitive Graphics. derived from this class are several different types of graphics, squares, rectangles, lines, etc. I am storing those graphics in an object that inherits collectionbase. This causes a problem because I cannot access any of the members in the derived class when they are added to the collection. Here is the default property for my primitivecollection class

[Code]...

My current workaround is to just put all of the public members in the base class, however this is starting to look ugly as I add more derived classes that need members available to the derived class only

View 3 Replies

Serial Port Added In One Form Not Accessible From Another Class?

Apr 19, 2011

I added a serial port com1 to my vb.net form. I created a new class and wrote a method to open the com1 and created its object in the main form and called the method and its opening.THen i created another class wrote a method to write data to the com and same way created an object and called it but i am getting the error as port is closed. What am i doing wrong.

View 1 Replies

Error When Unzipping File Using GZipStream(magic Number)

Jul 9, 2009

unzipping file using GZipStream.Heres the solution but i hope that i don't need to imports another dlls [URL] the zip files i compressed with 7z. and here the code...

[Code]...

View 8 Replies

DLL Or Code For Class That Can Be Added To An App To Pull Movie / TV Info Down From IMDB?

Feb 24, 2011

Is there a DLL or code for class (documented) that can be added to an app to pull movie and TV info down from the IMDB? I have see a lot of older stuff, but nothing documented or working outside of a semi-functional Python piece and am just not ready to wade my way through Python.

View 7 Replies

VS 2005 Variant - Values Coming Back From The Function Is Not Getting Converted To Object Type Properly

Jun 8, 2011

I have some ActiveX that was written for VB6. They all seem to return Variant types. Ex.

[Code]....

In this case the GetPosition control is returning a robot axis position. It looks to me like the values coming back from the function is not getting converted to object type properly.

View 2 Replies

Alter Items Added To Generic Collection (as Property Of Custom Class)

Jun 19, 2009

I have several custom classes in a VB.NET (VS2008) project which are related to each other through generic list collections. The lower tier classes refer directly to some of the parent classes (to make it easier to refer backwards up the chain). My question is, is it possible to add the reference to the parent class when the item is added to a collection, when that collection is a property?

Below is some sampling of code to illustrate.
Public Class FlexServer
Private m_FlexLicenses As List(Of FlexLicense)
Private m_Modules As List(Of FlexModule)
Public Property FlexLicenses() As List(Of FlexLicense)
[code] .....

In the code above I have the FlexServer class which refers has two lists as properties, one for FlexLicense and one for Modules. The FlexLicense class has a property to refer back to the FlexServer class that "owns" it. In order to update this property in code, I have to add the FlexLicense to the FlexServer.FlexLicenses list AND set the FlexLicense.FlexServer property. What I am looking for is, is there a way (in the property definition or wherever) to both add the item to the list and alter it at the same time?

View 1 Replies

Join - Added Three Tables To A LINQ To SQL Class - Then Connected To The Data Sources

Jan 23, 2012

I have three tables: BOOKS(BookID, Title, Author) CLASSES(ClassID, Title, MajorID,BookID) and MAJORS(MajorID, Description). I added these three tables to a LINQ to SQL class (UBooks.dbml) and then connected to the data sources. Then declared DataContext.

Using LINQ, my goal is to display all books in a grid which I have done with:

Dim allBooks = From Books In db.Books _
Order By Books.BookID _
Select Books

Me.BookBindingSource.DataSource = allBooks

Next I need to display all majors in a listbox. I would like the description to be shown however I am only getting the majorID to display with the code

lstMajors.DataSource = db.Majors

I have tried db.Majors.Description, however I am told then that Description is not a member of the LINQ table. and my final goal is to display all the books for whichever Major is selected in another data grid. This is what I am primarily concerned with right now. When using the SQLClient classes, I was able to create a string joining the tables (also had the description properly showing in the listbox, but that is of little importance right now to me). In the video tutorials I was able to watch whenever the tables were dragged from the database into the OR designer of the LINQtoSQL.dbml class file all of the associations were already there and the narrator only really had to do some drag and drop. Not only is drag and drop not working without these associations, but I'd much rather learn the code behind it.

View 4 Replies

Server Path - Added New Project Class Library To Make Dll File

Jun 14, 2009

I am just added new project class library to make dll file. when i write the first line i got this problem

Dim objStreamReader
As
New
StreamReader(Server.MapPath("TextFile.txt"))

name 'server' is not declared

View 11 Replies

VS 2005 - Code - Error - Value Of Type 'System.Collections.Generic.KeyValuePair(Of String, Long)' Cannot Be Converted

Feb 12, 2011

This code:

vb Dim s As String = strContents '<a global variable) Dim currentPos As Int64 = 0 Dim endPos As Int64 = strContents.Length - 1 '// A dictionary, used to count the frequencies Dim characterCounter As New Dictionary(Of [String], Int64)() While currentPos <> endPos '//

[CODE]...

Gives this error: Value of type 'System.Collections.Generic.KeyValuePair(Of String, Long)' cannot be converted to 'System.Collections.DictionaryEntry'.

View 2 Replies

VS 2005 Determine If DataRow Has Been Set To Added?

Jun 24, 2010

When a user clicks on the add button I do this:-oledrTest = oledstest.tables(0).newrowOn the save I need to know whether they have clicked on the add button or the edit button. In the passed I have set a variable to 1 for add and 2 for edit and on the save if its a 1 I do oledstest.tables(0).add(oledrtest).

View 12 Replies







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