无法将与单独数据库有关系的记录保存到 Lightswitch.ApplicationData
Unable Save a record to Lightswitch.ApplicationData with relationship to seperate database
设置:
2个数据库
Lightswitch.applicationdata 有 table 位客户
SQL.PlaceNamesData 有 table 个国家、州、地点和邮政编码
AddCustomer 屏幕是一个新数据屏幕。此屏幕有 3 个自动完成框,用于过滤国家、州、地点。邮政编码与地点是一对一的关系。
问题:
在提供的代码中,我试图将字段保存到新的客户记录中,但是所选的国家、州、地点和邮政编码没有与公司名称和其他详细信息一起保存。相反,PlaceNamesData 数据库中的每个外键都根据 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
Ahhhhg 已修复 - 内部数据库和外部数据库之间的关系设置不正确。
设置: 2个数据库 Lightswitch.applicationdata 有 table 位客户 SQL.PlaceNamesData 有 table 个国家、州、地点和邮政编码 AddCustomer 屏幕是一个新数据屏幕。此屏幕有 3 个自动完成框,用于过滤国家、州、地点。邮政编码与地点是一对一的关系。
问题: 在提供的代码中,我试图将字段保存到新的客户记录中,但是所选的国家、州、地点和邮政编码没有与公司名称和其他详细信息一起保存。相反,PlaceNamesData 数据库中的每个外键都根据 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
Ahhhhg 已修复 - 内部数据库和外部数据库之间的关系设置不正确。