Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Exception in Business Object GetDataset
Message
From
21/01/2005 09:03:47
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00979122
Message ID:
00979235
Views:
13
I got past the initial error I received, however I cannot add a record.
I have the UltraWInGrid set to have the Add New button enabled below the grid.
When I press the button I see a blank row that shows a 0 in the PK column and blank for the remaining cols.
The grid will not permit me to navigate away from the PK column showing 0 (e.g. using tab).

Not sure where the point of failure is with this problem adding information to the new grid row.
1. Have I correctly configured by Business Object, Custom Data Adapter, Typed DataSet, and Business.vb to handle the database (SQL with identity column for PK column)?
2. Have I bound the MM Infragistics WinUltraGrid and WinForm correctly to the Business Object?
3. What events in the grid need to be handled to call what MM functions to save the data changes (e.g. save new record)?

I suspect item number 3 but really could use guideance on this.

Code for the WinForm:
Imports System.Data
Imports OakLeaf.MM.Main.Business
Imports OakLeaf.MM.Main.Windows.Forms
Imports TSG.StellarVisiTrak.Business

Public Class VisitorTypeForm
    Inherits OakLeaf.MM.Main.Windows.Forms.mmBusinessForm

    ' Declare class variables to use for busness objects and datasets
    Private oVisitorType As VisitorType
    Private dsVisitorType As VisitorTypeDataset

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'Instantiate and register business objects with the form
        Me.oVisitorType = CType(Me.RegisterPrimaryBizObj(New VisitorType), VisitorType)
        
        ' Register children of the primary business object
        ' Not applicable - no children

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

        ' Retrieve all Visitor Types
        Me.oVisitorType.GetAllVisitorTypes()

    End Sub
On the form designer I dragged a dataset and configured it as a typed dataset.
In the dataset name field, I selected "referenced dataset" and then selected TSG.StellarVisiTrak.Business.VisitorTypeDataset.
This was done to enable the Infragistics UltraWinGrid to be able to generate a manual schema from my existing datasource without configuring it to use this as the datasource (as I am using the MM databinding property set to my VisitorType Business Object).

My Business.vb code:
Public Class ABusinessObject
    Inherits mmBusinessObject

    Public Sub New()
        Me.DatabaseKey = "StellarVisiTrak"
        Me.RetrieveAutoIncrementPK = True
    End Sub
End Class
My Custom Data Adapter code:
Imports System.Data
Imports OakLeaf.MM.Main.Data

Public Class VisitorTypeDataAccessSQL
    Inherits mmDataAccessSql

#Region " Component Designer generated code "

    Public Sub New(ByVal Container As System.ComponentModel.IContainer)
        MyClass.New()

        'Required for Windows.Forms Class Composition Designer support
        Container.Add(Me)
    End Sub

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Component overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
...(normal dispose code)...
    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    Friend WithEvents daVisitorTypeSqlDataAdapter As System.Data.SqlClient.SqlDataAdapter
    Friend WithEvents cmdVisitorTypeSqlSelectCommand As System.Data.SqlClient.SqlCommand
    Friend WithEvents cmdVisitorTypeSqlInsertCommand As System.Data.SqlClient.SqlCommand
    Friend WithEvents cmdVisitorTypeSqlUpdateCommand As System.Data.SqlClient.SqlCommand
    Friend WithEvents cmdVisitorTypeSqlDeleteCommand As System.Data.SqlClient.SqlCommand
...(Details of commands here)....
#End Region

    Public Overloads Overrides Function CreateDataAdapter() As IDataAdapter
        Return Me.daVisitorTypeSqlDataAdapter
    End Function
End Class
My Business Object code:
Imports System
Imports System.Data
Imports OakLeaf.MM.Main.Data

Public Class VisitorType
    Inherits ABusinessObject

    Public Sub New()
        Me.TableName = "VisitorTypes"
        Me.PrimaryKey = "VisitorTypeId"
    End Sub

    Protected Overrides Function CreateDataAccessObject(ByVal dataAccessClassName As String) As mmDataAccessBase
        Return New VisitorTypeDataAccessSQL
    End Function

    Protected Overrides Function CreateDataSet() As OakLeaf.MM.Main.Data.mmDataSet
        Return New VisitorTypeDataset
    End Function

    ' Returns a DataSet containing all VisitorTypes
    Public Function GetAllVisitorTypes() As DataSet
        ' Get a reference to the data access object
        Dim dao As mmDataAccessBase = Me.GetDataAccessObject()

        ' Create and configure parameter objects

        ' Get a DataSet filled with the result set
        Dim dsVisitorTypes As DataSet = _
        Me.GetDataSet( _
            "SELECT * FROM VisitorTypes")
        Return dsVisitorTypes
    End Function
End Class
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Previous
Reply
Map
View

Click here to load this message in the networking platform