Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Offline Views
Message
From
23/04/1999 08:59:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00210083
Message ID:
00211461
Views:
40
Hi again Josh,
Better a sample code what I mean. Bolded parts could make you follow easier. I suspect what I do wrong is in the way I set my remoteview (BTW I was trying to talk about remote views - local shouldn't have this problem) :
* Local database with remote view emp_view_remote - testdata!employee here
* All fields updatable except Photo - general (I couldn't include it:()
 
llOffline = createoffline("emp_view_remote","d:\temp\mydata")  && Create offline
if !llOffline
 messagebox("Couldn't created offline")
endif
set multilocks on
set exclusive off
use ("emp_view_remote")
 
3 && Go to a random record
scatter memvar memo
m.emp_id = str(recco()+1,3)
insert into ("emp_view_remote") from memvar && Newrec for lazy tester :)
=newrec() && Create a new empty rec
=newrec()
 
browse && Make edits and adds
use  && Close it
 

* Reconnect to the host and open the view.
USE emp_view_remote ONLINE EXCLUSIVE  && Get online
 
if  !tableupdate(1,.f.,"emp_view_remote")
 lnErrElems = aerror(aErrors)
 for ix = 1 to 6
  ? aErrors[ix]
 endfor  
 wait "Errors listed for rec : "+str(recno("emp_view_remote"),5)
endif 
use
dropoffline("emp_view_remote")
 

function newrec
scatter memvar memo blank && New empty record w/o nulls
 
* Normally this check is a matter just before tableupdate()
* fill in for test
for ix = 1 to fcount()
 if type(field(ix)) = "M"
    store " " to ("m."+field(ix)) 
<B>* Prevent null + invalid string length for ODBC driver
* Whenever I left memo in a new rec empty I get "Invalid string length"
 endif
 if type(field(ix)) $ "D"
    store {1/1/100} to ("m."+field(ix)) && Prevent datatype mismatch for date
 endif
 if type(field(ix)) $ "T"
    store dtot({1/1/100}) to ("m."+field(ix)) && Prevent datatype mismatch for datetime</B>
 endif
endfor
m.emp_id = str(recco()+1,3)
 
insert into ("emp_view_remote") from memvar
I wonder should I really do this type of check. TIA.
Cetin


>Cetin,
>
>I'm not sure I understand your question. In my application I update all field types the same way as I would using tables directly. Could you give me a little more information on what you're trying to do?
>
>
>>Hi Josh,
>>In my very early days in VFP I wasn't aware of offline views and created a routine mixing xBase approach with DBC's. Now I use offline views too. Yet there are few problems I couldn't find a workaround :
>>-Memo fields in newly added records (how to update them if blank)
>>-General fields (embedded)
>>-Date(time) fields (how to update them if blank)
>>Do you have any idea ? TIA
>>Cetin
>>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform