Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: System.Xml.Serialization.dll is missing


Message #1 by "Terry Carr" <Terry.Carr@r...> on Fri, 17 Aug 2001 15:29:44 -0400

From: Ken Woeste

Senior Software Engineer

Rina Systems Inc.

email: ken.woeste@r...





While converting from .net beta 1 to .net beta 2 I received the 

following error

when I tryed to define a dataset:



c:\inetpub\wwwroot\TSZone\ProductsDB.vb(73):

Unable to find a reference to assembly 'System.Xml' containing the 

implemented

interface 'System.Xml.Serialization.IXmlSerializable'. Add one to your 

project.



I could not add the reference to my project because I do not have a 

System.Xml.Serialization.dll installed on my computer. 

The other computer in our office that has .net beta 1 installed on it 

does have a System.Xml.Serialization.dll.

My environment is Windows XP Evaluation copy, Build 2505, with office 

2000 and .net beta 2.



WHAT IS THE CORRECT CODING, REFERENCES AND NAMESPACE FOR DEFINING AND 

POPULATING A DATASET?



Here is a copy of the entire Namespace.  Reference the line of code: 

Public Function GetReviews(ByVal productID As Integer) As DataSet



Imports System.Data

Imports System.Data.SqlTypes

Imports System.Data.SqlClient



Namespace tsZone



    '*******************************************************

    '

    ' ReviewsDB Class

    '

    ' Business/Data Logic Class that encapsulates all data

    ' logic necessary to list/access/add reviews from

    ' the IBuySpy Reviews database.

    '

    '*******************************************************



    Public Class ReviewsDB



        '*******************************************************

        '

        ' ReviewsDB.GetReviews() Method

        '

        ' The GetReviews method returns a bindable

        ' DataSet containing all user-submitted reviews for a

        ' specified product.

        '

        ' Other relevant sources: 

        '     + ReviewsList Stored Procedure

        '

        '*******************************************************  



        Public Function GetReviews(ByVal productID As Integer) As 

DataSet



            ' Create Instance of Connection and Command Object

            Dim myConnection As SqlConnection =3D New 

SqlConnection(tsZoneDB.ConnectionString)

            Dim myCommand As SQLDataSetCommand =3D New 

SQLDataSetCommand("ReviewsList", myConnection)



            ' Mark the Command as a SPROC

            myCommand.SelectCommand.CommandType =3D 

CommandType.StoredProcedure



            ' Add Parameters to SPROC

            Dim parameterProductID As SqlParameter =3D New 

SqlParameter("@ProductID", SqlDbType.Int, 4)

            parameterProductID.Value =3D productID

            myCommand.SelectCommand.Parameters.Add(parameterProductID)



            ' Create and Fill the DataSet

            Dim myDataSet As DataSet =3D New DataSet()

            myCommand.FillDataSet(myDataSet, "Reviews")



            ' Return the DataSet

            Return myDataSet



        End Function



        '*******************************************************

        '

        ' ReviewsDB.AddReview() Method

        '

        ' The AddReview method adds a new review into the

        ' IBuySpy Reviews database.

        '

        ' Other relevant sources: 

        '     + AddReview Stored Procedure

        '

        '*******************************************************  



        Public Sub AddReview(ByVal productID As Integer, ByVal UserID As 

String, ByVal Email As String, ByVal Password As String, ByVal rGrade As 

Integer, ByVal rText As String)



            ' Create Instance of Connection and Command Object

            Dim myConnection As SqlConnection =3D New 

SqlConnection(tsZoneDB.ConnectionString)

            Dim myCommand As SqlCommand =3D New SqlCommand("ReviewsAdd", 

myConnection)



            ' Mark the Command as a SPROC

            myCommand.CommandType =3D CommandType.StoredProcedure



            ' Add Parameters to SPROC



            Dim parameterProductID As SqlParameter =3D New 

SqlParameter("@ProductID", SqlDbType.Int, 4)

            parameterProductID.Value =3D productID

            myCommand.Parameters.Add(parameterProductID)



            Dim parameterUserID As SqlParameter =3D New 

SqlParameter("@UserID", SqlDbType.NChar, 50)

            parameterUserID.Value =3D UserID

            myCommand.Parameters.Add(parameterUserID)



            Dim parameterEmail As SqlParameter =3D New 

SqlParameter("@Email", SqlDbType.NChar, 50)

            parameterEmail.Value =3D Email

            myCommand.Parameters.Add(parameterEmail)



            Dim parameterPassword As SqlParameter =3D New 

SqlParameter("@Password", SqlDbType.NChar, 50)

            parameterPassword.Value =3D Password

            myCommand.Parameters.Add(parameterPassword)



            Dim parameterGrade As SqlParameter =3D New 

SqlParameter("@rGrade", SqlDbType.Int, 4)

            parameterGrade.Value =3D rGrade

            myCommand.Parameters.Add(parameterGrade)



            Dim parameterText As SqlParameter =3D New 

SqlParameter("@rText", SqlDbType.NChar, 8000)

            parameterText.Value =3D rText

            myCommand.Parameters.Add(parameterText)



            Dim parameterReviewID As SqlParameter =3D New 

SqlParameter("@ReviewID", SqlDbType.Int, 4)

            parameterReviewID.Direction =3D ParameterDirection.Output

            myCommand.Parameters.Add(parameterReviewID)



            Try

                ' Open the connection and execute the Command

                myConnection.Open()

                myCommand.ExecuteReader()

            Catch e As Exception

                ' An error occurred, pass the exception up

                Throw e

            Finally

                ' Close the Connection

                If myConnection.State =3D DBObjectState.Open Then

                    myConnection.Close()

                End If

            End Try



        End Sub



    End Class



End Namespace






  Return to Index