11/22/2024 6:51:08 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss general external development topic (related or not to SalesLogix development). View the code of conduct for posting guidelines.
|
|
|
|
Updating Recordset issues...
Posted: 24 Sep 07 10:11 AM
|
I am working on moving some scripts that I have running inside the application, to a .net version so we can run them from a monitored task monitor as a console script.. I have one update that is collecting data from our DW which is an Oracle DB and then saving it to an array, using that array to update RS and update the SLX table via the provider so we get sync files. For somereason I have a problem with my recordset, VS is claiming it is marked ReadOnly and not updateable. I think I have the correct items identified, maybe I am missing something simple I'm not seeing... I'm posting the code maybe someone else sees what I am missing.. thanks so much
============= CODE =========================== sSQL = "Select * From CDW_SLX_FC_VIEW"
Dim alUpdate As New ArrayList For Each dr As DataRow In oOracleConn.ExecuteQuery(sSQL).Rows Dim oFA_Info As New CFA_Data With oFA_Info .Id = dr("App_Id") .GEID = dr("GEID") .FCID = dr("CHANNEL_AGENT_ID") .First_Name = dr("FIRST_NAME") .Middle_Initial = dr("MIDDLE_INITIAL") .Last_Name = dr("LAST_NAME") .SSB_Branch_Id = dr("SSB_BRANCH_ID") .SSN = dr("SSN") .Work_Phone = dr("WORK_PHONE") .EMail = dr("EMAIL") .Council_Level = dr("COUNCIL_LEVEL") .Split_Id = dr("CHANNEL_SPLIT_ID")
End With alUpdate.Add(oFA_Info) Next
'Open SLX Connection SLXcn = New ADODB.Connection SLXcn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
'Must Be modified when Admin password changes SLXConn = "Provider=SLXOLEDB.1;Data Source=CAINYCQAE04;Initial Catalog=CAI_SLX_7_QA;User Id=adminassword=ersist Security Info=True;Extended Properties = Port=1706;Log=On"
Try SLXcn.Open(SLXConn) Catch e As Exception Throw New Exception("Cannot open the Saleslogix connection", e) End Try SLXcn.Execute("Delete From C_FC_Data")
SLXSQL = "Select * From C_FC_Data Where 1 = 2" SLXrs = New ADODB.Recordset SLXrs.Open(SLXSQL, SLXcn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1) With SLXrs For Each oFA_Info As CFA_Data In alUpdate
.AddNew() .Fields("C_FC_DATAID") = CreateSlxID("C_FC_DATA", 1) .Fields("SSB_BRANCH_ID") = oFA_Info.SSB_Branch_Id .Fields("FIRST_NAME") = oFA_Info.First_Name .Fields("MIDDLE_INITIAL") = oFA_Info.Middle_Initial .Fields("LAST_NAME") = oFA_Info.Last_Name .Fields("SSN") = oFA_Info.SSN .Fields("GEID") = oFA_Info.GEID .Fields("FCID") = oFA_Info.FCID .Fields("WORK_PHONE") = oFA_Info.Work_Phone .Fields("EMAIL") = oFA_Info.EMail .Fields("COUNCIL_LEVEL") = oFA_Info.Council_Level .Fields("SPLIT_ID") = oFA_Info.Split_Id .UpdateBatch(ADODB.AffectEnum.adAffectCurrent) Next
End With
=================== End of CODE ===================== |
|
|
|
Re: Updating Recordset issues...
Posted: 24 Sep 07 11:02 AM
|
Question(s):
- Does your Alias has RW and RO passwords? (I don't see them defined on the Connection string, so it is a possibility....)
- Are you sure that the Recordset is being opened? Place a Break on the debugger after opening it and verify that the schema it has matches the Schema that you are looking for.
- Also, try calling just .Update (instead of .UpdateBatch) since you are calling it right after creating a single record.
|
|
|
|
Re: Updating Recordset issues...
Posted: 24 Sep 07 11:27 AM
|
Thank Raul,
However our system doesn't have RO or RW passwords..
The error I am addressing is happening before run time.. in the design stage.. in VS I am getting the issue with the field being ReadOnly.
The code is copied from another script I have that works correctly.. Just missing something.. maybe time for a side by side compare
Thanks again |
|
|
|
Re: Updating Recordset issues...
Posted: 24 Sep 07 11:36 AM
|
Is it only one specific field?
Does it fail when right after you invoke AddNew, while Setting a certain field to an specific value, or when calling the UpdateBatch function?
As I had suggested before, place a Breakpoint right after opening the recordset and check its properties. Then find out exactly where it fails, if it is on an specific field, you may want to try bypassing it all together. |
|
|
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|