add a record
Sylvain Perque
sylvain.perque at ac-reims.fr
Mon Jul 3 09:06:37 CDT 2006
Hi Ruslan,
Thanks for your answer, but I have still the problem.
Perhaps I do wrong with creation of my database ?
Valentina = new (Xtra("Valentina"))
Valentina.Init(200 * 1024, "", "")
gdb = void
gdb = new(Xtra "VDatabase", #kLocal)
gDb.create(Mypath, #kDsc_Dat_Blb_Ind)
tblRes = gDb.createTable( "Resultats" )
tblRes.createStringField("TDBName", 30)
vTDBName = tblRes.field("TDBName")
vTDBName.value = "My name"
RecID = 0
RecID = tblRes.addRecord()
gDB.flush()
-- close
gCursor = void
gDb.close()
gDb = void
if objectP(Valentina) then
-- When we finish work with Valentina engine we should shutdown it.
Valentina.shutDown()
end if
Sylvain
> On 6/30/06 5:16 PM, "Sylvain Perque" <sylvain.perque at ac-reims.fr> wrote:
>
> > Hi,
> > I can't find what i do wrong. A error occure after I close the base.
> > If I keep it open, there is not error.
> > The code for one field :
> > ---------------------------------------------------------------------
> > Valentina = new (Xtra("Valentina"))
> > Valentina.Init(200 * 1024, "", "")
> > gDb = new (Xtra "VDatabase", #kLocal)
> > gDb.open("My Path\Name of my db.vdb")
>
> ok
>
> > -- To add records to the table we need build a cursor using SQL query.
> > query = "select * from Resultats WHERE false"
>
> ok
>
> > -- This is the new way to build a cursor
> > gCursor = gDb.sqlSelect(query, #kServer, #kReadWrite, #kRandom)
>
> ok
>
> > tblRes = gDb.table("Resultats")
> > vTDBNom = tblRes.field("TDBName")
> > RecID = tblRes.addRecord()
> > tblRes.flush()
>
> Oops. Few mistakes here
>
> 1) if you want use cursor to add a record, then you do not need Table.
>
> 2) you do Vtable.addrecord, but where you have assign fields ??
>
> Must be something as
>
> gCursor = gDb.sqlSelect(query, #kServer, #kReadWrite, #kRandom)
>
> gCursor.SetBlank()
> gCursor.Field("TDBName").value = ...
> gCursor.AddRecord
>
> Or can be simply via SQL
>
> gDB.SqlExecute( "INSERT INTO Resultats (TDBName) VALUES(v1) " )
>
> If you can do simple INSERT, no need produce cursor...
>
>
>
> > -- close
> > gCursor = void
> > gDb.close()
> > gDb = void
> > if objectP(Valentina) then
> > -- When we finish work with Valentina engine we should shutdown it.
> > Valentina.shutDown()
> > end if
> > -----------------------------------------
> > thanks to help a so newbie.
>
> --
> Best regards,
>
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
>
> Valentina - Joining Worlds of Information
> http://www.paradigmasoft.com
>
> [I feel the need: the need for speed]
>
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
--
Ce message a été vérifié par MailScanner
pour des polluriels (SPAM) et rien de
suspect n'a été trouvé.
More information about the Valentina
mailing list