Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No update tables are specified. 2

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I have built a Remote View into a SQL Server data table.

I used the following code to build the view:
Code:
OPEN DATABASE "TS ALAF"
CREATE SQL VIEW "ALAF_Mod1" REMOTE CONNECTION Touchstar SHARE AS ;
   SELECT ContactID,;
   ProjectID,;
   Call_Date,;
   APPL,;
   CRC,;
   Cust1Type,;
   Cust1Status,;
   Cust1Policy,;
   Cust1ActionDate,;
   Cust1ReqStatus,;
   Cust1DeliveryReq,;
   Cust1NotTaking,;
   Cust1Notes,;
   Agent_No,;
   agent_name,;
   AgentPhone;
   FROM alaf_leads
DBSETPROP('ALAF_Mod1','view','tables','dbo.ALAF_Leads')
CLOSE DATABASE

* --- Now I Set The View Cursor Properties to make it Updatable ---
OPEN DATABASE "TS ALAF"
USE ALAF_Mod1 IN 0
SELECT ALAF_Mod1
* --- Get List Of Field Names ---
mnFldCnt = AFIELDS(aryFields)
USE

* --- I do this 15 times for 15 separate views like above ---
FOR ViewCntr = 1 TO 15
   mcViewName = "ALAF_Mod" + ALLTRIM(STR(ViewCntr))
   mcPolicyFld = "Cust" + ALLTRIM(STR(ViewCntr)) + "Policy"

   SET DATABASE TO "TS ALAF"

   * --- Define Key Fields ---
   DBSETPROP(mcViewName+".ProjectID",'Field','KeyField',.T.)
   DBSETPROP(mcViewName + "." + mcPolicyFld,'Field','KeyField',.T.)

   * --- Make Each Field Updatable ---
   FOR I = 1 TO mnFldCnt
      mcFldName = aryFields(I,1)
      IF UPPER(LEFT(mcFldName,5)) = "CUST1"
         mcFldName = "Cust" + ALLTRIM(STR(ViewCntr)) + SUBSTR(mcFldName,6)
      ENDIF
      DBSETPROP(mcViewName+"."+mcFldName, 'Field','UpDatable',.T.)
   ENDFOR

   * --- Set Final Update Property ---
   DBSETPROP(mcViewName,'View','SendUpdates',.T.)
ENDFOR

However when I USE the View ALAF_Mod1 and attempt to do a REPLACE <whatever> I get an error message:
No update tables are specified. Use the Tables property of the cursor.

I have no clue as to why these views are not allowing me to update them. I must have missed something.

Your advice would be greatly welcome.

Thanks,
JRB-Bldr
 
Two added detail to the above posting.

The application is written in VFP 7

And, based on another posting found on the net, this might be somehow pertinent.

Someone else mentioned getting this error when accessing a Memo field.

One of the SQL Server table fields is not a Memo field, but it is 200 characters long.

Thanks,
JRB-Bldr
 
A couple of points:

- Have you tried opening the remote view in the View Designer? That will tell you at a glance if you have set the various properties correctly.

- Re the memo field: I don't think this is relevant to your problem but is the 200-char field by any chance a double-byte or Unicode field (for example, is it an NCHAR or NVARCHAR)? If so, that would probably map to a memo field in the view.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike - thanks for the reply.

The View will not open in the View Designer since the source table has too many columns (over 200 fields) - at least that's the error message I get when I do try to open the View Designer.

Actually, while awaiting a reply I think that I finally got things working in spite of a mis-leading error message.

I have left out a
CURSORSETPROP('Buffering',5,mcAlias)
Now I often do not need that line by relying solely on the inherent Row buffering, but apparently this time it is needed.

At least once I added it, the code began to work without the error message.

Thanks,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top