Source language: Translate to:

Problem with inserting new records in Access DB

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Problem with inserting new records in Access DB

Postby kpmcginley » Mon Oct 06, 2008 7:28 pm

I have reported this problem before. When attempting to update an ACCESS table, the structure of the resultant db variable omits the name of the db, that is, it is structured as TABLE.FIELD rather than DBNAME.TABLE.FIELD. I cannot understand why it would do this. I include below the code which updates the TABLE:
Code: Select all
dbpGetFieldNames "checkin" "mednote" "," "[fieldnames_mednote]"
StrParse "[fieldnames_mednote]" "," "[field]" "[field_num]"
SetVar "[mn1]" "[periodics.clientname]"
SetVar "[mn2]" "[periodics.mis]"
SetVar "[mn3]" "![periodics.dob]"
dgStartProcessInd "Loading DB"
Loop "1" "[field_num]" "[i]"
dbpExecSQL "checkin" "Insert into mednote [field[i]] VALUES [mn[i]]" ""
.SetVar "[checkin.mednote.[field[i]]]" "![mn[i]]"
Endloop
SetVar "[noteupdated]" "yes"
dgStopProcessInd


This is the second table in this database to behave in this fashion. The code updated the table once, that is, there is one record in the table. But all subsequent attempts to update the TABLE result in incorrectly structured variables and no new data being added to the TABLE. Help!!
kpmcginley
 
Posts: 19
Joined: Mon Apr 07, 2008 1:43 pm

Update

Postby kpmcginley » Mon Oct 06, 2008 7:37 pm

I should have noted a further anomolie. As you can see from the code above, I first used the "SetVar command preceeded {before the begining of the loop) with a dbpAddRecord command. When using this, I got two sets of variables: one structured correctly and another with identical values which had the structue of TABLE.FIELD. The second method, using SQL, simply resulted in the ill-structured variables. Neither process updated the DB.
kpmcginley
 
Posts: 19
Joined: Mon Apr 07, 2008 1:43 pm

Postby Gaev » Tue Oct 07, 2008 6:24 am

kpmcginley:

Could it be that your ...
Code: Select all
dbpExecSQL "checkin" "Insert into mednote [field[i]] VALUES [mn[i]]" ""
... command results in a temporary Table ? ... which might be causing the creation of variables of the form [Table.Field] ... perhaps the name of the Temporary Database is being seen by NeoBook as a null/empty value.

Might try specifying a value (e.g. john1234) for the final parameter in the dbpExecSQL command ... then see if the variable includes that value between the Table and Field names.

The other thing I would try is ...
Code: Select all
SetVar "[thisField]" "[field[i]]"
SetVar "[thismn]" "[mn[i]]"
dbpExecSQL "checkin" "Insert into mednote [thisField] VALUES [thismn]" "john1234"
... just in case.
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 2 guests

cron