Home > Back-end >  Do with the access database is really a headache!!!!! Do you have any? Frequently, speaking, reading
Do with the access database is really a headache!!!!! Do you have any? Frequently, speaking, reading

Time:10-30

with the access database is really a headache!!!!! Do you have any? Frequently, speaking, reading and writing is easy to 1 to 2 g. Horrible!
More strange is that some computer can. I use win2003 how make normal. A virtual machine with XP/Windows 7: normal. But I pretended to the original system.


start or exit compression software this I know.
But in the process of software running because of software function can't operate compression.


, there is no good way to??









.

CodePudding user response:

Tools have a compression and repair the database options, should be able to reduce your file size, not affect the content,

CodePudding user response:

 USES Sysutils ComObj, Dialogs. 

Function DaoActive (var DaoObject: OleVariant) : Boolean;
The function DaoCompactDB (const FileName, Pwd: string) : Boolean;
The function DaoRepairDB (const FileName: string) : Boolean;

Implementation

Function DaoActive (var DaoObject: OleVariant) : Boolean;
The begin
Result:=False;
Try
DaoObject:=GetActiveOleObject (' DAO. DBEngine. 36 ');
Result:=True;
Except,
Try
DaoObject:=CreateOleObject (' DAO. DBEngine. 36 ');
Result:=True;
Except,
DaoObject:=Null;
end;
end;
end;

//compression Access database
The function DaoCompactDB (const FileName, Pwd: string) : Boolean;
Var
Db: OleVariant;
TempFile as expected: the string;
The begin
Result:=False;
Try
If not DaoActive (db) then
The Exit;
Try
TempFile as expected:=ExtractFilePath (FileName) + 'msaTemp. MDB';
Db.Com pactDatabase (FileName, TempFile as expected,,, '; The PWD='+ PWD);
The DeleteFile (FileName);
RenameFile (TempFile as expected, the FileName);
Result:=True;
Except,
On E: EOleException do
ShowMessage (E.M essage);
End
The finally
Db:=the Unassigned;
end;
end;

//repair Access database
The function DaoRepairDB (const FileName: string) : Boolean;
Var
Db: OleVariant;
The begin
Result:=False;
Try
If not DaoActive (db) then
The Exit;
Try
Db. RepairDatabase (FileName);
Result:=True;
Except,
On E: EOleException do
ShowMessage (E.M essage);
End
The finally
Db:=the Unassigned;
end;
end;

Should check the DAO in DaoActive version, generality was strongest

CodePudding user response:

Compression code is. When I started the program under compression.
But in the process of the program is run bigger is no way out.
want to find out the cause of the explosion is what??

CodePudding user response:

Consider using an in-memory database frequently, speaking, reading and writing, and exit the program to write again

CodePudding user response:

Access to this function?

CodePudding user response:

reference 4 floor shuihan20e response:
consider using an in-memory database frequently, speaking, reading and writing, and exit the program I will write when



+ 1
General delete data file type database, just make a delete tags, the actual is not deleted, so the file will be more and more big, the Access of repair compression function is to remove the tag data which do really deleted, so write when the database is in frequent, write operations to reduce as much as possible

CodePudding user response:

Change the MSSQL.

CodePudding user response:

View your program is resident program, not often restart, then use Access database using real problem, changing the SQL Server or MySQL, SQL Server but is still relatively good, MySQL in the long run will be disconnected, is not good control, as long as it is ok to change the connection to other database, the code is not generally do not need to change,

CodePudding user response:

The access data volume small, big unreliable,
Still in the database, sqlite or used

CodePudding user response:

refer to the eighth floor nm_wyh response:
view of your program is resident program, often not restart, then use Access database using real problem, changing the SQL Server or MySQL, SQL Server but is still relatively good, MySQL in the long run will be disconnected, is not good control, as long as it is ok to change the connection to other database, code does not generally do not need to change,

Disconnect is not afraid of, regardless of your TABLE, or QUERY, execution will determine whether with the database connection has been disconnected, if break the meeting automatic reconnection, but will take some time

CodePudding user response:

I used to use Access, now use SQLite