general observation
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon Apr 28 11:26:22 CDT 2003
on 4/28/03 1:13 AM, Zav - Alex Zavatone at zavpublic at mac.com wrote:
Hi Zav,
> All in all, I have found this Valentina stuff REALLY REALLY &*** confusing.
>
> What would be a freaking godsend would be to have SIMPLE Director
> files in a valentina examples section that would allow the following
> in in lingo.
>
> 1) Create a simple database and table.
> 2) Add a record to that simple database and table
> 3) Read a record from that simple database and table.
>
> I'm just trying to do a simple username, password, hint database and
> this ARRGH thing feels WAY more complex than I was hoping it was.
>
> I haven't been able to add records yet. Yes, I am stupid but there
> has GOT to be a way to make this simpler just to do the basics. A
> "bare bones, basics" set of documentation and examples maybe?
Sorry to hear this.
Have you see example001.dir in V4MD folder.
I believe this is simply exaple as you need.
Okay, it create 2 tables.
You ask for one table.
Well, let's together do your task. :-)
I open by the way that example:
And will do simple copy - paste into this letter to get code you need.
In fact below is the SIMPLEST code which can be.
If you still have questions let me know.
------------------------------------------------------------------
global gDB
global gCursor
----------------------------------------------------------
on startMovie
global gDB
-- The next line help us debug code using "Valentina for Director"
-- To see how it works uncoment next line.
-- ValentinaDebugLevel(2)
ValentinaInit( 4 * 1024 * 1024, "", "" )
CreateDB
AddRecords
ReadRecord
end
----------------------------------------------------------
on StopMovie
global gDB
CloseDatabase( gDB )
set gDB = void
ValentinaShutDown
end
----------------------------------------------------------
on CreateDB
global gDB
set gDB = new(xtra"VDataBase")
createDatabase(gDB, the moviePath & "test.vdb", 4)
-- Create table "Artist"
set ArtistRef = MakeNewBaseObject(gDB,"User")
set fldRef = addField(gDB, ArtistRef, "Name", #kTypeVarChar, 504 )
set fldRef = addField(gDB, ArtistRef, "Password", #kTypeVarChar, 504 )
end CreateDB
----------------------------------------------------------
on AddRecords
global gDB
-- create empty cursor (no records)
set UserCursor = new( xtra "VCursor", GetRef(gDB),
"select * from User WHERE RecID = 0")
SetBlank(UserCursor )
SetField(UserCursor , "Name", "Zav" )
SetField(UserCursor , "Password", "Alex" )
AddRecord(UserCursor )
end
----------------------------------------------------------
on ReadRecord
global gDB
-- select all records in table:
set UserCursor = new( xtra "VCursor", GetRef(gDB),
"select * from User")
// read field of CURRENT record.
set name = GetField(UserCursor , "Name" )
set passw = SetField(UserCursor , "Password" )
end
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list