Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
My Other Picker is Pickier
Message
De
10/05/2005 09:05:51
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01011435
Message ID:
01012410
Vues:
24
This all AGAIN, seems to work when UPDATING records but not when ADDING new records.
In the code listing at the end of the post, CompanySelected and VisCompanySelected are valued correctly yet any way I try to save the row or dataset fails with CANNOT INSERT NULL INTO COMPANYNAME in Vistors

Please help me understand what is (or is not) happening correctly!

So... even though I have set the mmPicker to data bind via
BindingSource: Company
BindingSourceMember: CompanyName
BindingValueSource: Visitor
BindingValueSourceMember: CompanyName

... it is not placing the item selected into the Bus Obj dataset automatically (as a combo box would)???

I guess you would leverage the Private Sub Picker_ItemSelected(ByVal sender As Object, ByVal e As OakLeaf.MM.Main.Windows.Forms.mmPickerItemSelectedEventArgs) Handles Picker.ItemSelected form event
to place this change (or new) item selected into the dataset of the Bus Obj (and rebind).
What is a best practice example of how to do this?

Perhaps?:
        ' Update the Bus Obj dataset with Picker Item Selected Text Value
        Dim VisitorView As DataRowView = Me.GetCurrentRow(oVisitor)
        Dim VisCompanySelected As String
        VisCompanySelected = VisitorView("CompanyName").ToString
        Dim CompanySelected As String = _
            Me.VisitorCompanyNamePicker.Text
        VisitorView("CompanyName") = CompanySelected
        Dim VisitorCompanyName As String = Me.oVisitor.DataRow.Item("CompanyName").ToString
        ' Save the Item Selected from mmPicker to Bus Obj dataset
        VisCompanySelected = VisitorView("CompanyName").ToString
        ' Following Code PRODUCES CANNOT INSERT NULL CompanyName ERROR
        Dim result As mmSaveDataResult = _
            Me.oVisitor.SaveDataSet(Me.oVisitor.GetCurrentDataSet())
        ' Following Code also PRODUCED CANNOT INSERT NULL CompanyName ERROR
        'Me.oVisitor.SaveRow()
        ' Raises the Navigated event to get new Company Bus Obj (Hook)
        Me.oVisitor.NavigatedData(VisitorView)
My NEW button click code:
    Private Sub VisitorNewButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VisitorNewButton.Click
        Me.oVisitor.NewRow _
            (New VisitorDefaultValues _
            (DateTime.Now, _
            System.Security.Principal.WindowsIdentity.GetCurrent.Name.ToString))
        ' Move to last row (new row)
        Me.BindingContext(Me.oVisitor.GetCurrentDataSet(), "Visitors").Position = _
            Me.oVisitor.GetCurrentDataSet().Tables("Visitors").Rows.Count - 1
        Dim VisitorView As DataRowView = Me.GetCurrentRow(oVisitor)
        Dim VisCompanySelected As String
        VisCompanySelected = VisitorView("CompanyName").ToString
    End Sub
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform