Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
My Other Picker is Pickier
Message
From
05/05/2005 16:40:09
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
My Other Picker is Pickier
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01011435
Message ID:
01011435
Views:
76
I have a mmPicker on my WinForm configured as follows:
VisitorCompanyNamePicker

BindingSource: Company
BindingSourceMember: CompanyName
BindingValueSource: Visitor
BindingValueSourceMember: CompanyName

DataCommand: SELECT CompanyName FROM Companies Order By CompanyName
GridColumns: VisitorCompanyColumn (BindingSourceMember = CompanyName)

PickListDisplayMember: CompanyName
PicListSearchField: CompanyName
PickListValueMember: CompanyName

I can use this control successfully to update existing records, but get the following error each time I use the control to assign a value to a new record:
Cannot insert the value NULL into column 'CompanyName', table 'StellarVisiTrakProd.dbo.Visitors'; column does not allow nulls. INSERT fails.
The statement has been terminated.

My Form Methods for New and Save are as follows:
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
    End Sub

    Private Sub VisitorSaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VisitorSaveButton.Click
        If Me.oVisitor.IsChanged = True Then
            Dim result As mmSaveDataResult = _
                Me.oVisitor.SaveDataSet(Me.oVisitor.GetCurrentDataSet())
        Else
            MsgBox("No changes made to Visitors")
        End If

    End Sub
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Next
Reply
Map
View

Click here to load this message in the networking platform