Hello, I have an issue, I have a custom Button of type Ajax, and it works correctly in local, but as soon as I put the project in production (MS SQL server on Apache environment), whenever I click this Ajax button I get this error:
“Error while accessing the database
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server] incorrect syntax near ‘)’”
Then I try to click on “View SQL” but nothing happens.
The code is simple, it’s an Insert (sc_exec_sql) followed by the sc_lookup and finally a sc_redir.
The insert happens even if I get this error, so what doesn’t happen is the sc_redir.
This is the code:
$sql_insert = "INSERT INTO dbo.TblItem(ItemTyp, ItemName) VALUES ( '{ItemTyp}','{ItemName}')";
sc_exec_sql($sql_insert);
sc_lookup(id,"SELECT SCOPE_IDENTITY()");
$new_itemID=$id[0][0];
sc_redir('item_details_newly_added', selectedItemID=$new_itemID, '_parent');
so if the INSERT is executed (I see the new record being added in my grid), this means something happens after the INSERT to get the error.
The only ‘)’ that I can see (the error says there is a syntax error near ‘)’,
is or in the sc_lookup or in the sc_redir.
It might be the SCOPE_IDENTITY() ?
But that would be strange because on local it works, and my local scriptcase is connected to the same exact DB that is connected to production!
What this could be?