Real Software Forums
http://forums.realsoftware.com/

Adding a new database record
http://forums.realsoftware.com/viewtopic.php?f=13&t=39436
Page 1 of 1

Author:  Chris Benton [ Thu Jun 16, 2011 4:35 am ]
Post subject:  Adding a new database record

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

Author:  tarnoun [ Thu Jun 16, 2011 6:42 am ]
Post subject:  Re: Adding a new database record

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.

Author:  Chris Benton [ Thu Jun 16, 2011 7:50 am ]
Post subject:  Re: Adding a new database record

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

Author:  tarnoun [ Thu Jun 16, 2011 8:49 am ]
Post subject:  Re: Adding a new database record

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.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/