Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating data from a view
Message
From
15/03/2005 05:58:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
Database:
Oracle
Miscellaneous
Thread ID:
00995689
Message ID:
00995865
Views:
18
This message has been marked as the solution to the initial question of the thread.
>Cetin,
>
>No I have not set the view properties. And I am doing all this in code, so I am not using a veiw designer.
>
>I have two fields to change. The status field comes across as a two digit number, 23, 25, 30, 48... as a character. But in my select, I had to select for status < 85 (not a character). And the date comes across in 20050130 character format that I want to convert to a 01/30/05 character. (Same number of characters). My view displays in a grid, but I thinkit is not updatable for some reason.
>
>Ron

Ron,
If you don't set the properties (in code if you're doing in code) then it's not updatable.
PS: If you're doing all these in code "create view ..." call each time would add new records to your DBC and DBC would get fat. You might instead think of using SPT. SPT cursors can also be made updatable. ie:
Set Date to mdy
lnHandle=SQLStringConnect('DRIVER=SQL Server;SERVER=(local);Trusted_Connection=Yes')
SQLExec(lnHandle,'create database myTestDB')
SQLExec(lnHandle,'use myTestDB')
SQLExec(lnHandle,'create table myTest (myKey int identity not null,f1 varchar(10) null, myDate datetime null)')
SQLPrepare(lnHandle,'insert into myTest (f1,myDate) values (?m.c1,?m.d1)')
For ix=1 to 10
	m.c1 = 'MyValue'+Transform(ix)
	If ix%3#0
		m.d1 = Date()-ix
	Else
		m.d1 = .null.
	endif
	SQLExec(lnHandle)
EndFor
SQLExec(lnHandle,'select myKey,f1,convert(varchar(10),myDate,101) as myDate from myTest','v_test')
cursorsetprop('KeyFieldList','myKey','v_test')
cursorsetprop('WhereType',1,'v_test')
cursorsetprop('Tables','myTest','v_test')
CURSORSETPROP("UpdateNameList", ;
	"myKey myTest.myKey,"+;
	"f1  myTest.f1,"+;
	"myDate  myTest.myDate",'v_test')
cursorsetprop('UpdatableFieldList','f1,myDate','v_test')
cursorsetprop('SendUpdates',.t.,'v_test')
cursorsetprop('Buffering',5,'v_test')
Browse fields myKey,f1,myDate :p='@D' title 'Before Update'
* Check if invalid date is getting back
replace myDate with .null. for !IsNull(myDate) and Empty(ctod(myDate))

tableupdate(2,.t.,'v_test')
SQLExec(lnHandle,'select * from myTest','afterupdate')
SQLDisconnect(lnHandle)
select afterupdate
Browse title 'AfterUpdate'
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