Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Sep 21, 2019 2:40 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Adding a new database record
PostPosted: Thu Jun 16, 2011 4:35 am 
Offline

Joined: Thu Jul 30, 2009 6:30 am
Posts: 30
Hi All,
I am using the code below to add new records to a database that I created. The program that this routine is attached verifies that it is connected to the DB. The routine attempts to write some data to a table called "params" from a few text boxes. When I check the table using the real studio IDE, there are no records in the table. A record count of the table also confirms this. Can anybody indicate why the code below is not working?

dim rec as DatabaseRecord

rec = New DatabaseRecord
rec.Column("cat") = "USER"
rec.Column("p1") = TXT(0).TEXT
rec.Column("P2") = TXT(1).TEXT
rec.Column("P3") = "NOT SET"
rec.Column("P4") = "NOT SET"
rec.Column("P5") = "NOT SET"

APP.REG.InsertRecord ("PARAMS", rec)
APP.REG.Commit

Thanks in advance
Chris Benton


Top
 Profile  
Reply with quote  
 Post subject: Re: Adding a new database record
PostPosted: Thu Jun 16, 2011 6:42 am 
Offline
User avatar

Joined: Sat Jan 13, 2007 11:37 am
Posts: 108
Location: Rabat, Morocco
Hi,

First: is the table's name "PARAMS" or "params"?
Second: You should test for APP.REG.Error right after inserting the record and right after the commit. If there is an error, check for the values of APP.REG.ErrorCode & APP.REG.ErrorMessage. Hopefully, you should find useful informations here.

HTH,
--
Eric.


Top
 Profile  
Reply with quote  
 Post subject: Re: Adding a new database record
PostPosted: Thu Jun 16, 2011 7:50 am 
Offline

Joined: Thu Jul 30, 2009 6:30 am
Posts: 30
Thanks Eric,
After the commit function, the routine reports back error code '0' and message 'not an error', so I am no wiser as to why records aren't being added to the table.
regards
Chris


Top
 Profile  
Reply with quote  
 Post subject: Re: Adding a new database record
PostPosted: Thu Jun 16, 2011 8:49 am 
Offline
User avatar

Joined: Sat Jan 13, 2007 11:37 am
Posts: 108
Location: Rabat, Morocco
Chris Benton wrote:
Thanks Eric,
After the commit function, the routine reports back error code '0' and message 'not an error', so I am no wiser as to why records aren't being added to the table.
regards
Chris

And what about between the insertion and the commit?
--
Eric.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group