I am trying to insert data into a SQL Server database from TwinCat 2 program. When the trigger is activated, I am getting the following error: 262145
racer_name : STRING(256);
racer_name := 'CS1';
FB_FormatStringC1_lap_db(
    sFormat:='INSERT INTO demo VALUES (%S, %D, %D)',
    arg1:= F_STRING(racer_name),
    arg2:= F_DWORD(C1_Lap_Minutes),
    arg3:= F_DWORD(C1_Lap_Seconds),
    bError=> ,
    nErrId=> ,
    sOut=>sInsertStringC1_lap_db );
FB_DBRecordInsertC1_lap_db(
    sNetID:= ,
    hDBID:=1 ,
    sInsertCmd:=sInsertStringC1_lap_db ,
    bExecute:=  dummy,
    tTimeout:=T#30s ,
    bBusy=> bBusyInsert,
    bError=> bErrInsert,
    nErrID=> nErridInsert,
    sSQLState=> );
The communication to the server is running, because i tried to import only integers and it's working without any problem.
Maybe I am not formatting the string variables properly?
Thanks in advance.


 
                        
This is your query:
You are giving 3 columns for insert while your table has 4. Assuming that
idis autogenerated, you can explictly not provide it by enumerating the target columns:This is one of the reasons why always enumerating the target columns in a
insertstatement is a best practice.