DBImport V3.7 Introduction:
1: First, then introduce the highlights feature:
The main upgrade features are:
1: Add (Truncate table) Clear table re-insert function:
Clear the plug, you can guarantee the data of two libraries consistent, I like this feature.
2: Information Bar adds red section:
There is too much black information, sometimes the error message is flooded, separate red block to identify the error message, clear some.
3: Add save all configuration and configure restore:
Previously only the configuration of the database link was saved, in order to 4th, all configurations were included, including table names.
4: Increase the self-starting parameters, for the timing function of the boot:
Since the startup parameter is-True or-1, the next version will be processed into a service that supports restarting the computer and continuing the service.
5: Resolve software stability (auto exit) issue.
: Click to download
The following highlights the process of solving the problem:
Remember when I published the ASP. Aries Framework, there is a demo address: http://aries.cyqdata.com.
Because there are always individuals who do not delete users or data or modify the login password, in order to prevent this situation:
I put the dbimport on the server, and also turned on the timing function, thought can once and for all.
As a result, the software runs and exits automatically, and then it is executed manually.
So currently in the execution of the scheme, locked the file's read-only property, to avoid user modification data.
Today just think about it, so I thought to solve it, so we have the following content:
Resolved process: 1: First confirm the situation:
Run the software separately, turn on the timer function, and then go out for a stroll and look back at the results:
After several confirmations, and the problem is not simple:
A: It's not responding.
B: Throw exception definition to Application.Run (separate run-time performance exits the software directly).
2: View Exceptions by IntelliTrace:
"IntelliTrace Event and call information" is turned on:
F5 Run, Throw: " attempts to read or write protected memory. This usually indicates that other memory is corrupted . "
I thought I found a problem and it ended up in the pit.
1: This exception is thrown when a method returns an array of t[] GetList (). 2: This exception is thrown when dictionary adds an array add (key,t[]). 3: When the parameter of the method is: public mdatatable Select (params object[] selectcolumns) This array, throw this exception.
Well, this array is what offended Microsoft, to be so bullied by it.
Changed a half-day code, the code of t[] array to change to list<t>, generally another step, to normal operation.
Later did not fold, after all, some public methods have params parameter is not good change, had to change the option to "Only IntelliTrace event."
Run, wait for the bug, click All interrupts:
You can then see the events that were executed:
Combined with your own recorded error message:
Looking back at the code, finally found a bug:
if (Isgoon) {using (SqlBulkCopy SBC = new SqlBulkCopy (Con, (keepid? SqlBulkCopyOptions.KeepIdentity:SqlBulkCopyOptions.Default) | Sqlbulkcopyoptions.firetriggers, Sqltran)) {SBC. BatchSize = 100000; Sbc. DestinationTableName = Sqlformat.keyword (MDT. TableName, Daltype.mssql); Sbc. Bulkcopytimeout = AppConfig.DB.CommandTimeout; foreach (mcellstruct column in MDT. Columns) {SBC. Columnmappings.add (column. ColumnName, column. ColumnName); } SBC. WriteToServer (MDT); }} if (_dalhelper = = null) {con. Close (); con = null; } else if (Iscreatedal) {_dalhelper.endtransaction (); _dalhelper.dispose (); }
This code, at the time of the exception, the link can not be closed, the focus of it or open the business, did not expect to be old, hundred or one lose.
so run for a long time, the connection pool exhausted, plus the transaction card dead double blow, the interface into a long period of card dead .
If you find a bug fix, close the link to the finally of the try:
finally { ifnull) { con. Close (); NULL ; } Else if (Iscreatedal) { _dalhelper.endtransaction (); _dalhelper.dispose (); }}
Question 2nd: Automatic exit problem, have experience.
After all, when the entrepreneurial Micro-blog Fan wizard, I met:
For WinForm Software, do not operate the UI in the thread, do not believe: Startform.checkforillegalcrossthreadcalls = false;
So, change all the code to the main thread delegate invocation, similar to the following code:
Private Delegate voidSettexthandle (stringIdstringvalue); Private voidThreadsettext (stringIdstringvalue) { This. Controls.find (ID,true)[0]. Text =value; } Private voidSetText (stringIdstringvalue) { if( This. invokerequired) {This . Invoke (new settexthandle (threadsettext), new object [] {ID, value}); } Else{threadsettext (id, value); } }
Well, at this point, the stability of the problem solved, happy weekend!
DBImport V3.7 release and software stability (auto exit problem) process sharing