Prevent duplicate record saving to connector database

I set a grid connector for database. I will load and insert to database.


 dpGrid = new dataProcessor("GridConnector.ashx?strSQL=SELECT TABLE_TYPE,FIELD_NAME,FIELD_DISPLAY_NAME,IS_RESERVED,DISPLAY_ON_TOP,INPUT_TYPE,ALLOW_EMPTY,CONTENT_TYPE,MAX_LENGTH,FILL_REST,VALUE_JUSTIFY,NOTE FROM MASTER_PARAMETER_DEF&strUser='SYSTEM'");

  dpGrid.setDataColumns([true, true, true,true]);
  dpGrid.init(grdResult);

 strContrLoad = "GridConnector.ashx?strSQL=SELECT TABLE_TYPE,FIELD_NAME,FIELD_DISPLAY_NAME,IS_RESERVED,DISPLAY_ON_TOP,INPUT_TYPE,ALLOW_EMPTY,CONTENT_TYPE,MAX_LENGTH,FILL_REST,VALUE_JUSTIFY,NOTE FROM MASTER_PARAMETER_DEF where recID > " + strLastBatchAddRecID + " and recID <= " + rId;
                    
grdResult.loadXML(strContrLoad), 

Normally, I enter a record data then use < loadXML > into a connector database. I want to ask how prevent prevent duplicate record saving to connector database.

Sorry, but I don’t follow

Can you provide a bit more details about problematic scenario, how data is saved and after which actions duplicate record do occurs

Stanislav,

OK ! Now I provide a demo for my action.

The main point is to save the data to connector database and prevent duplicate record.

Maybe have many methods to do but I want to hear your suggestions ?

Thanks !
demo.rar (294 KB)

If you are using dataprocessor and connector ( seems so ) you can just mark field in question as unique on DB level, in such case, when inserting new record connector will catch sql error and will return xml response with “error” action type, which can be handled as

dpForm.attachEvent("onAfterUpdate", function (sid, action, tid, tag) { if (action == "error") alert("Non unique record"); ...