I have used Inserts, selects, updates, deleted without problem all over the program but for some reason this specific section causes it to except and not run the SQL I send it.
I am trying to "UPDATE SectionTable(AreaID) VALUES ('+IntToStr(ActClient.AreaID)+') WHERE SectionID='+IntToStr(iCount)"
The section with the ID "iCount" exists deffinately. The ActClient.AreaID is "2" and its overwriting null data in the "SectionTable" table.
What is the problem here?
OpenDatabase(slDb);
sltb:=sldb.GetTable('SELECT * FROM SectionTable WHERE SectionID='+IntToStr(iCount));
OutputDebugString(PAnsiChar(sltb.FieldAsString(sltb.FieldIndex['SectionID'])+sltb.FieldAsString(sltb.FieldIndex['Gender'])+sltb.FieldAsString(sltb.FieldIndex['CompetitionID'])));
sSQL := 'UPDATE SectionTable(AreaID) VALUES ('+IntToStr(ActClient.AreaID)+') WHERE SectionID='+IntToStr(iCount);
sldb.ExecSQL(sSQL);
CloseDatabase(slDb);
I get this error message appear when this is ran.
---------------------------
Debugger Exception Notification
---------------------------
Project CompetitionServer.exe raised exception class ESQLiteException with message 'Error executing SQL.
Error [1]: SQL error or missing database.
"UPDATE SectionTable(AreaID) VALUES (2) WHERE SectionID=2": near "(": syntax error'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
UPDATE table SET column = expression, column = expression WHERE predicates
Related
I pushed a commit to git, and when I tried publishing the site, I get this error
'Web deployment task failed.(An error occurred during execution of the
database script.The error occurred between the following lines of the
script: 4264 and 4279. "IF NOT EXISTS(SELECT*FROM[_EFMIGRATIONHISTO"
Cannot insert the value NULL into column ' '.
I have searched everywhere and I cannot find a solution, and now I'm getting the 'Site Under Construction' error when I try my site's URL.
From the error:
You have a table Called 'Notes'
You are trying to insert some data in the 'Notes' table
The migration script is trying to insert data but the value for the 'PrescriberId' column is null in your migration script
Try to put a value for the 'PrescriberId' or set the 'Identity Increment' property of the 'PrescriberId' column to 1 so that it generates an id while inserting the data.
I'm facing difficulty to find a correct way to get errors on ApplyUpdates method, using FireDAC in memory (CachedUpdates).
Here is my scenario, a master-detail relationship, compounded by:
1 TFDConnection
2 TFDQuery
2 TDataSource
1 TFDSchemaAdapter
Both queries are setted as CachedUpdates and are linked to FDSchemaAdapter.
The FDQuery2 (detail) is linked with the master by MasterSource property. MasterFields and IndexFieldNames are setted as "idMaster". The property FetchOptions.DetailCascade is also checked.
I also have a button to perform the apply:
try
FDConnection1.StartTransaction;
FDSchemaAdapter1.ApplyUpdates(0);
FDQuery1.CommitUpdates;
FDQuery2.CommitUpdates;
FDConnection1.Commit;
except on E: Exception do
begin
FDConnection1.Rollback;
raise Exception.CreateFmt('Something went wrong. Error: %s', [E.Message]);
end;
end;
Everything is working fine so far.
The problem occurs when my database throw an exception, such a constraint violation. The exception is not raising. Consequently, my transaction is not 'rollbacked'.
ps: I'm using Delphi XE7 and Firebird 2.5
As the documentation states:
ApplyUpdates returns the number of errors it encountered. Based on
this return value and the setting of AMaxErrors successfully, applied
updates are removed from the centralized change log. If the update
process is aborted before all updates are applied, any unapplied
updates remain in the change log.
ApplyUpdates does not raise an
exception. Instead, the application should review erroneous records
using Reconcile and the OnReconcileRow event handler or the
FilterChanges and RowError properties for each dataset. For more
details, read "Reviewing errors" at Caching Updates.
So... you should not be expecting an exception but you should be checking the value returned by ApplyUpdates to decide if you can commit or handle errors.
I am new to db2 and got stuck in a problem which shouldn't be tricky.
I have a procedure try_a which calls another procedure try_b
in both the procedures i have declared exit handler for sql exception.
Suppose in try_b divide by zero error is encountered then that is returned using SIGNAL.
When try_a (exit handler written)calls try_b then on case of divide by zero error in try_b ,sql exception of inner block is not shown.
Can you please help how can this be achieved.
I don't have a sample code now. Will try to put that tomorrow.
When you use SIGNAL in the inner stored procedure, the condition that is raised is the user-defined type, not the original condition that cause the inner condition handler to be invoked. It has its own SQLCODE, SQLSTATE, and message. You could use the RESIGNAL statement to raise the same condition.
Alternatively, you could log error messages to a temporary table or a file in each condition handler.
In i4gl IDE I am facing this exception in a report program for printing deductions from pay for all personnel of a particular category.
This program is working fine for employees of one category but fails in case of employees of other category.
Please suggest a solution.Thanking in anticipation.
I have mentioned the lines of code where error message points fingers to and also the error message below:
let _stmt = "select * from pay_slip where per_no = '",r_hist.per_no ,
"' and yrmn = '",_yrmn,"' and govt_str ='", __hdr clipped,"'"
prepare prep_stmt from _stmt
execute prep_stmt into r_slip.*
error message:
Program stopped at "DED_SUM_EX.4gl", line number 109.
SQL statement error number -201.
A syntax error has occurred.
I would suggest:
DISPLAY your SQL statement before running it.
Run the SQL statement in DB-Access to see what is going on, the error will be more explicit.
I am getting the following error:
2013-11-14 11:57:33,994 [TestScheduler_QuartzSchedulerThread] ERROR Common.Loggi
ng.Factory.AbstractLogger.Error(:0) - An error occurred while scanning for the n
ext trigger to fire.
Quartz.JobPersistenceException: Couldn't acquire next trigger: Cannot insert the
value NULL into column 'SCHED_TIME', table 'quartz.dbo.QRTZ_FIRED_TRIGGERS'; co
lumn does not allow nulls. INSERT fails.
The statement has been terminated. ---> System.Data.SqlClient.SqlException: Cann
ot insert the value NULL into column 'SCHED_TIME', table 'quartz.dbo.QRTZ_FIRED_
TRIGGERS'; column does not allow nulls. INSERT fails.
The statement has been terminated.
I am using the example from HERE and I think I need to understand how jobs work with ADO.Net Jobstore better. My code works perfectly with RAMJobStore. Is there something else I have to do to get ADO to scan for triggers?
Turns out when I looked closer at the errors it was referencing the older version of Quartz.net.