Well, as I do it, I always create my tables in code, so I always
create a table like this :
db is a realsqldatabase object, loaded and ready to go
db.sqlexecute ("create table mytable (id integer primary key,
somefield varchar.....)")
and there you have id which automatically increments after every
insert (as long as you don't put a value in there like
db.sqlexecute ("insert into mytable (somefield) values ("taada")")
Trausti
On May 13, 2006, at 1:25 AM, Dennis Birch wrote:
I just tried:
ID = CategoryInfoRS.Field("_rowid").IntegerValue
and I'm still getting a NilObjectException (a further test shows that
.Field("_rowid") is nil.
Any other suggestions?
On 5/12/06, Trausti Thor Johannsson <[EMAIL PROTECTED]> wrote:
if you don't create a variable which is an integer primary key, it
gets created for you, and it is called _rowid, note the _sign there.
Trausti
On May 13, 2006, at 12:55 AM, Dennis Birch wrote:
> I'm having no luck trying to figure out how to use what I
understand
> is an automatically generated field for a REALSQLDatabase.
>
> According to the LR: All REAL SQL Database tables have an Integer
> Primary Key column. If you don't explicitly such a column, one
will be
> created for you. You can refer to the INTEGER PRIMARY KEY column
using
> the "rowid" keyword.
>
> So I wrote the following code to store the rowID in a listbox where
> I'm showing the table's other values:
>
> CategoryInfoRS.MoveFirst
> While not CategoryInfoRS.EOF
> s = CategoryInfoRS.Field("bc_Name").StringValue
> if s <> "" Then
> CatList.AddRow s
> s = CategoryInfoRS.Field("bc_Code").StringValue
> CatList.Cell(CatList.LastIndex, 1) = s
> s = CategoryInfoRS.Field("bc_Type").StringValue
> CatList.Cell(CatList.LastIndex, 2) = s
>
> ID = CategoryInfoRS.Field("rowid").IntegerValue ' ---> NOE
HERE
> CatList.CellTag(CatList.LastIndex, 0) = ID
> End
> CategoryInfoRS.MoveNext
> Wend
>
> And I get a NilObjectException when I run this code at the point in
> the code indicated (NOE HERE) because .Field("rowid") is nil.
>
> Can somebody help me make this work correctly?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>