1) exception: ierrorinfo. getdescription failed because of e_fail (0x80004005.
The main cause of this problem is that the SQL statement executed on Access contains components not supported by access (such as functions in SQL Server ).
2) unable to update
After the table is migrated to access, it is found that the table cannot perform new operations, and no error is reported.
The main cause of this problem is that the SQL statements built in the Dal layer are inconsistent with the matching Parameter order. As follows:
Code
Oledbcommand comm = dalmailfactory. createoledbcommand ();
Comm. commandtext = "Update mailcontacts set name = @ name, email = @ email, description = @ description, username = @ username where id = @ ID ";
// Comm. Parameters. addwithvalue ("@ ID", Ent. ID); // #1
Comm. Parameters. addwithvalue ("@ name", Ent. Name );
Comm. Parameters. addwithvalue ("@ email", Ent. Email );
Comm. Parameters. addwithvalue ("@ description", Ent. Description );
Comm. Parameters. addwithvalue ("@ username", Ent. username );
Comm. Parameters. addwithvalue ("@ ID", Ent. ID); // #2
Return oledbhelper. executenonquery (Comm );
/**//*
* In commandtext, the order of parameters is @ name, @ email, @ desciption, @ username, @ ID)
*
* The following parameter values cannot be updated if @ ID is written to #1. The @ ID must be written to the position #2 in the same order as the parameters in commandtext to be updated successfully.
*/
3) syntax error of insert into statement
The main cause of this error is that the SQL statement is written in a lazy manner, and the field in the table is not added with []. As follows:
Code
Insert into userbaseinfo ([username], [Password], [name].
Values (@ username, @ password, @ name.
/*
This error may occur if [] is not added to username, password, and name.
This is not to say that these three words will cause this error. I still have many fields not written after the statement.
*/