Problem updating lookups in web .net
Posted: Tue Oct 16, 2012 2:57 pm
I have been working with code on a dll (in vb.net) that has been working for quite a while. It seems to working fine. Now I'm trying to do some of the same things in web - asp.net, and I can get the lookups data via the lookups api but when I try to update data in the lookup, it errors. I simplified it to a very simple new little table and I'm still getting this error "The entered field code does not correspond to a valid field code". I checked on the field names and they all look correct. Also, it let's me set the row/data up until the lookups.applychanges(table) line of code.
Server Error in '/Generic/TransactionsList/SelectServerTest' Application.
--------------------------------------------------------------------------------
The entered field code does not correspond to a valid field code.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Below is my Code
Dim sps As New SoftPro.Select.Client.SelectServer("http://spapp:8000") ', credentials)
Dim spec As New LookupQuerySpec()
Dim lookups As Lookups = sps.GetService(Of Lookups)()
'On Error Resume Next
Dim LookupsTable As New DataTable
LookupsTable = dsLookups.Tables(0)
sps.EnsureAuthenticated()
spec.Filter = "[Name] like '%%'"
spec.Table = "AbstractorTesting"
spec.SchemaOnly = False
spec.MaxRows = "50"
Dim table As ILookupTable = lookups.QueryTable(spec)
Dim row As ILookupRow, value As ILookupValue ', icol As ILookupColumn
row = table.NewRow()
value = row.NewValue(False, "AAA-Test")
row.Item("Name") = value
table.Rows.Add(row)
lookups.ApplyChanges(table)
Below is my Error
Exception Details: SoftPro.OrderTracking.Common.LookupException: The entered field code does not correspond to a valid field code.
Source Error:
Line 145:
Line 146: table.Rows.Add(row)
Line 147: lookups.ApplyChanges(table)
Line 148:
Line 149: 'lookups.ApplyChanges(ilookuptable)
Source File: \\devwebs\inet\MTAWebDevNEW\Generic\TransactionsList\SelectServerTest\Default.aspx.vb Line: 147
Stack Trace:
[LookupException: The entered field code does not correspond to a valid field code.]
SoftPro.OrderTracking.Client.Lookups.ApplyChanges(IEnumerable`1 tables, LookupTableApplyChangesSettings settings) +2035
SoftPro.OrderTracking.Client.Lookups.ApplyChanges(ILookupTable[] tables) +11
SelectServerTest._Default.SetLookup(String TableName, String FilterField, String FilterText, DataSet dsLookups) in \\devwebs\inet\MTAWebDevNEW\Generic\TransactionsList\SelectServerTest\Default.aspx.vb:147
SelectServerTest._Default.submit_Click(Object sender, EventArgs e) in \\devwebs\inet\MTAWebDevNEW\Generic\TransactionsList\SelectServerTest\Default.aspx.vb:181
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Please advise.
Server Error in '/Generic/TransactionsList/SelectServerTest' Application.
--------------------------------------------------------------------------------
The entered field code does not correspond to a valid field code.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Below is my Code
Dim sps As New SoftPro.Select.Client.SelectServer("http://spapp:8000") ', credentials)
Dim spec As New LookupQuerySpec()
Dim lookups As Lookups = sps.GetService(Of Lookups)()
'On Error Resume Next
Dim LookupsTable As New DataTable
LookupsTable = dsLookups.Tables(0)
sps.EnsureAuthenticated()
spec.Filter = "[Name] like '%%'"
spec.Table = "AbstractorTesting"
spec.SchemaOnly = False
spec.MaxRows = "50"
Dim table As ILookupTable = lookups.QueryTable(spec)
Dim row As ILookupRow, value As ILookupValue ', icol As ILookupColumn
row = table.NewRow()
value = row.NewValue(False, "AAA-Test")
row.Item("Name") = value
table.Rows.Add(row)
lookups.ApplyChanges(table)
Below is my Error
Exception Details: SoftPro.OrderTracking.Common.LookupException: The entered field code does not correspond to a valid field code.
Source Error:
Line 145:
Line 146: table.Rows.Add(row)
Line 147: lookups.ApplyChanges(table)
Line 148:
Line 149: 'lookups.ApplyChanges(ilookuptable)
Source File: \\devwebs\inet\MTAWebDevNEW\Generic\TransactionsList\SelectServerTest\Default.aspx.vb Line: 147
Stack Trace:
[LookupException: The entered field code does not correspond to a valid field code.]
SoftPro.OrderTracking.Client.Lookups.ApplyChanges(IEnumerable`1 tables, LookupTableApplyChangesSettings settings) +2035
SoftPro.OrderTracking.Client.Lookups.ApplyChanges(ILookupTable[] tables) +11
SelectServerTest._Default.SetLookup(String TableName, String FilterField, String FilterText, DataSet dsLookups) in \\devwebs\inet\MTAWebDevNEW\Generic\TransactionsList\SelectServerTest\Default.aspx.vb:147
SelectServerTest._Default.submit_Click(Object sender, EventArgs e) in \\devwebs\inet\MTAWebDevNEW\Generic\TransactionsList\SelectServerTest\Default.aspx.vb:181
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Please advise.