Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 7 Jahren, 8 Monaten
Letzter Beitrag:
vor 7 Jahren, 8 Monaten
Beteiligte Autoren:
Rich, Al, Milton, Jimbo

WebDev 15 - Can't Add to a File

Startbeitrag von Rich am 15.07.2010 20:13

I have a table on a form that has add and remove buttons. When I try to add a record nothing happens.

Here is the code for the add button:
userprjs.PROJECTID = TableProjects.ProjectId
userprjs.USERID = gUserId

When this code is run nothing happens, the record is not added to the file.

I can add records using WDMap and Navicat for MySQL but not in code.

I have other tables in the project that work. This is the only one that has a problem.

What am I missing :confused:


Hi Rich,

I have had the same problem when creating a new database in WD15. When I imported a WD14 database it worked okay. I would be interested to hear from anyone as well.


von Milton - am 15.07.2010 20:45

Hi Rich,

HReset(..) clears the file buffer. If there are other fields in the file's description, especially keay, there will be a duplicates situation (duplicate nulls, duplicate empty strings etc), thus adding a second record will fail. Look at HErrorInfo(Fulldetails) after HAdd(..).
Kind regards, Guenter

von Jimbo - am 16.07.2010 07:44
To expand on my problem, I have two tables on the form a Projects table and a Users Projects table. I want to select a project in the Projects Table and add it to the Users Projects table, but I don't want duplicates. I am not happy with the WD built-in duplicates user interface so I usually write my own.

Here is the code.
IF TableUserProjects..Occurrence >= 1 THEN // Check for duplicate project
IF TableSeek(TableUserProjects.Number,TableProjects.Number)= True THEN
// Duplicate project
Info(TableProjects.Name + " is already assigned to " + users.FULLNAME)
userprjs.PROJECTID = TableProjects.ProjectId
userprjs.USERID = gUserId

If I comment out the check for duplicate project code everything works but the user is still able to add duplicate projects to the User Projects table.

What to do :confused:

von Rich - am 16.07.2010 21:18
Hello Rich

Your syntax for TableSeek() is incorrect.
IF TableSeek(TableUserProjects.Number,TableProjects.Number)= True THEN

Tableseek() does not return true/false. It returns the row number if found or -1 if not found.
It also has a parameter (False) for a generic search or (True) for an exact match.

Try the following syntax

LFoundRow is int
LFoundRow = TableSeek(TableUserProjects.Number,TableProjects.Number,True)
If LFoundRow -1
//duplicate row found


von Al - am 16.07.2010 23:13

I will try this code tomorrow.

von Rich - am 16.07.2010 23:46

Re: WebDev 15 - Can't Add to a File SOLVED!


I appreciate your taking the time to answer my question.

All is now well :spos:

von Rich - am 17.07.2010 21:05
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.