Invalid Curs ref

Ruslan Zasukhin sunshine at public.kherson.ua
Mon May 5 01:03:04 CDT 2003


on 5/5/03 12:12 AM, Zav - Alex Zavatone at zavpublic at mac.com wrote:

>> I swear this used to work last week.  Today it returns a - value for
>> the cursor and an error on setblank.  Any idea why?
>> 
>> Mac OS X 10.2.5, DMX.
>> 
>> Before running, I InitValentina and manually delete the username.vdb file
>> 
>> on CreateUserDatabase
>>   put "creating user database"
>>   myDBPath = the moviepath & "username.vdb"
>>   myDBTable = "Users"
>>   myDB = new( xtra "VDatabase")-- NEW INSTANCE OF THE XTRA
>> 
>>   CreateDataBase(myDB, myDBPath,1) -- CREATE DATABASE FROM SCRATCH
>> 
>>   -- MAKE A TABLE  **** The baseref OBJ is the table
>>   myBaseTableRef = MakeNewBaseObject(myDB, myDBTable)


>>   -- ...then your addField stuff.
>>   userField = AddField(myDB, myBaseTableRef,"Username",#kTypeString,10)
>>   passwordField = AddField(myDB, myBaseTableRef,"Password",#kTypeString,10)
>>   hintField = AddField(myDB, myBaseTableRef,"Hint",#kTypeString,30)
>> 
>>   -- create a cursor object
>>   myDBref = myDB.GetRef()
>>   --
>>   myCrsRef = new(xtra "VCursor", myDBref, "SELECT * FROM" && myBaseTableRef)
>>   myCrsRef.SetBlank()
>> 
>> Thanks.
> 
> The error message Valentina is giving me is 602 (Table not found) for
> the curs ref.  What I fail to comprehend is why can't Valentina
> create a cursor for a table it just created?  I'm passing the correct
> ref right?

Zav, 

You have made small simple mistake :-)

 myCrsRef = new(xtra "VCursor", myDBref, "SELECT * FROM" && myBaseTableRef)

Please think, what string of query you get?

Look, myBaseTableRef is some integer number.
For example myBaseTableRef = 42358975
You can see this when you debug in Director your script code.

So you get string of SQL query as
    "SELECT * FROM 42358975"

But correct SQL query must looks as

    "SELECT * FROM Users"
                   ^^^^^^^ this must be NAME of table.

I hope now it is clear why Valentina say table not found. Yes?

-- 
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://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list