设定: 2个数据库 Lightswitch.applicationdata与表Customers SQL.PlaceNamesData包含表Country,States,Places和PostCodes AddCustomer屏幕是一个新数据屏幕。此屏幕有3个自动完成框,用于过滤国家,州,地点。邮政编码是与地方的一对一关系。
问题: 在提供的代码中,我尝试将字段保存到新的客户记录,但是所选的国家/地区,州,地点和邮政编码不会与公司名称和其他详细信息一起保存。而是PlaceNamesData DB中的每个外键都根据postcodenum字段按升序保存。
我已经尝试了几天不同的方法了。如何将筛选的屏幕值保存到客户记录中的外键?
Namespace LightSwitchApplication
Public Class AddCustomer
Private Sub AddCustomer_InitializeDataWorkspace(saveChangesTo As List(Of Microsoft.LightSwitch.IDataService))
' Write your code here.
Me.CustomerProperty = New Customer()
End Sub
Private Sub AddCustomer_Saved()
' Write your code here.
Me.Close(False)
Application.Current.ShowDefaultScreen(Me.CustomerProperty)
End Sub
Private Sub SaveCustomer_Execute()
Dim newCustomer As Customer = Me.CustomerProperty
Dim co As Country = Me.CountryProp.Country
Dim st As State = Me.StateProp.State
Dim pl As Place = Me.PlaceProp.Place
Dim po As PostCode = Me.PlaceProp.PostCode
With newCustomer
.CompanyName = Me.CustomerProperty.CompanyName
.Street = Me.CustomerProperty.Street
.AccountTerms = Me.CustomerProperty.AccountTerms
.TaxRate = Me.CustomerProperty.TaxRate
.Country = co
.State = st
.Place = pl
.PostCode = po
End With
End Sub
Private Sub AddCustomer_Saving(ByRef handled As Boolean)
' Write your code here.
handled = True
End Sub
End Class
End Namespace

答案 0 :(得分:0)
Ahhhhg已修复 - 内部DB与外部DB之间的关系设置不正确。