How does the classic asp connection.errors collection actually work? - asp-classic

I am trying to confirm how the actual ADODB.Connection.Errors collection should actually work.
My interpretation at the moment is that the connection will hold all the errors for the all the procedures that have been executed on that connection.
So I should be able to say
on error resume next
... code goes here ... 2 or more command objects execute procedures against the database on the same connection
if con.Errors <> 0 then
loop through all the Errors objects (1 for each procedure that would've been executed on the connection)
end if
However I have implemented that basic structure and I only get the one error description? So I am looking for someone to confirm that is the case. Does the Errors collection hold more than one error for more than one procedure? Or is if multiple errors occurred for one procedure?
I can't seem to find any documentation that would indicate exactly what would happen in this case.
Thanks,

from Errors Collection (ADO) - MSDN:
Any operation involving ADO objects can generate one or more provider
errors. As each error occurs, one or more Error objects can be placed
in the Errors collection of the Connection object. When another ADO
operation generates an error, the Errors collection is cleared, and
the new set of Error objects can be placed in the Errors collection.
So, to catch all errors, seems to be need to check the collection after each possible error.

Related

Using vs Try/Catch/End try (Exit Function)

We have found out during our SQLite implementation that SQLite databases will get locked without fully disposing any Sqlite Commands and Sqlite DataReaders.
As as result we are modifying our Try..Catch..End Try with Using...End Using.
Any datareaders within the Using..End Using are disposed after closing.
Commands are disposed with the End Using.
However many of our Try..Catch..End Try includes the "Exit Function" within the Catch portion.
Is there a way within the Using..End Using to Catch an exception, deal with it, exit the function, while still being able to dispose with the command like End Using does?
We are using a combination of c# and vb.net within our application/libraries
The documentation says that
the Using block guarantees disposal of the resources, no matter how you exit the block.

When to check for database is locked errors in sqlite

On the linux server, where our web app runs, we also have a small app that uses
sqlite (it is written in c).
For performing database actions we use the following commands:
sqlite3_prepare_v2
sqlite3_bind_text or sqlite3_bind_int
sqlite3_step
sqlite3_finalize
Every now and then there was a concurrency situation and I got the following error:
database is locked
So I thought: "This happens when one process writes a certain record and the
other one is trying to read exactly the same record."
So after every step-command, where this collision could be, I checked for this error. When it happended, I waited a few milliseconds and the tried again.
But the sqlite error "database is locked" still occurred.
So I changed every step command and the code lines after it. Somehow I thought that this "database is locked" error could only occur with the step command.
But the error kept coming.
My question is now:
Do I have to check after any sqlite3 command for "error_code ==5" (database is locked)?
Thanks alot in advance
If you're receiving error code 5 (busy) you can limit this by using an immediate transaction. If you're able to begin an immediate transaction, SQLite guarantees that you won't receive a busy error until you commit.
Also note that SQLite doesn't have row-level locking. The entire database is locked. Using a WAL journal, you can one writer and multiple readers. With other journaling methods, you can have either one writer, or multiple readers, but not both simultaneously.
SQLite Documentation on 'SQLITE_BUSY'

Error while saving data to data table in Pega PRPC

While saving data in Pega PRPC using activity with Obj-save method, I got following error message:
pyCommitError: A commit cannot be performed because a deferred save of instance ANDY-FW-ANDYCARRENTALFW-DATA-CARINFO L3 failed: code: SQLState: Message:
Can anyone share some idea on how to fix this issue?
Andy
This message could come when we have a field which has a less field length specified in DB and we are trying to insert bigger string in the field.
There could be other reasons as well.See Tracer.
Deferred save of instance usually fails due to locked instance which you are trying to commit. Or the record you are trying to commit is stale (someone else committed before your commit)
Ideally, this behavior can be observed because of the lock on the work object not being held while you are trying to save the object. Make sure you acquire the lock before updating and save.
Additionally please check if privilege is given to the operator.

Why do I get exception "The execution of the InstancePersistenceCommand named LoadWorkflowByInstanceKey was interrupted by an error"

After doing some refactoring to my WF4 service, I got this exception when calling some of the operations:
The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}LoadWorkflowByInstanceKey was interrupted by an error.
My xamlx file contains a few receive/sendreplytoreceive pairs, as shown below. The exception sometimes happens on receive2, sometimes receive3.
receive1 (no correlation, cancreateinstance=true)
send reply to receive (initializes content correlation on generated ID)
receive2 (correlates on ID, cancreateinstance=false)
send reply to receive
receive 3 (correlates on ID, cancreateinstance=false)
send reply to receive
After doing a lot of debugging and making sure all correlations where set up right, the exception disappeared for new instances of the workflow.
What does the exception mean, and why did it show up and why did it dissappear all of a sudden? Is it a code/xamlx issue or something with the infrastructure (AppFabric/SQL)?
I'm hosting the WF service with IIS/AppFabric, using AppFabric' SQL persistence.
According to this support note this error can be the result of a race condition between the Receive and a Delay activity expiring. Is this possible in your workflow.
I kinda figured mine out... aparently if you point your persistance store in a SQL previous to 2012 you get the error... so all i had to do is put mine persistance store in a SQL 2012...
When I had this problem it turned out to be a mistake in my connection string when instantiating the persistence store object.
SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(connStr);
I realise this an old question but fixing the connection string got rid of my error while running store.Execute() so I thought I'd share!

Error on deserialization of Array Collection in Flex: RangeError: Error #2006

I am getting this error during serialization:
RangeError: Error #2006: The supplied
index is out of bounds.
The error occurs in AbstractMessage.as when it attempts to read input of timestamp.
After that my fault handler gets this error:
faultCode:Server.Acknowledge.Failed
faultString:'Didn't receive an
acknowledge message' faultDetail:'Was
expecting
mx.messaging.messages.AcknowledgeMessage,
but received null'
It appears to be happening as a result of an ArrayCollection coming back from the server.
Is it necessary to create custom classes to handle serialization of ArrayCollections with custom objects as shown here?
I've also followed the serialization recommendations here with no luck.
Thanks for your help!
The solution was correcting a mistake in writeExternal on the Java side. I was being very careful about the order of serialization but was writing an int as an object using writeObject. This will cause errors in completely unrelated code on the client side after it tries to readInt.
I just experienced this error myself, and it turns out it is caused by the Flash Builder Network monitor being enabled!! FB 4.0.1 this is.
I was going nuts for not finding the reason, so sharing it here for your peace of mind.

Resources