Home > Software engineering >  Access the access in the vb environment, how to use in the join statement like fuzzy matching
Access the access in the vb environment, how to use in the join statement like fuzzy matching

Time:11-08

BBS everyone a great god, and I run directly under the Access to the following SQL statements can be carried out smoothly, can get the expected results,
Select * into TableTemp2 from (select B.R owID, a. eforeRevise, A.A fterRevise, a. ackUp from TableReviseAuthor1 as A inner join TableTemp as B on B.A uthor like '*' & amp; A. eforeRevise & amp; The '*')
But under VB environment, the above SQL statement to be executed to Access the same action, the like of which after * % must be used to replace, perform the following statement:
Public PuChaDataBase As ADODB. Connection
The Set PuChaDataBase=New ADODB. Connection
PuChaDataBase. The ConnectionString="Provider=Microsoft. Ace. The OleDb. 12.0; Data Source="& amp; App. The path & amp; "\ PuChaDataBase MDB" & amp; "; Persist Security Info=True "
PuChaDataBase. Open
StrSQL="select * into TableTemp2 from (select B.R owID, a. eforeRevise, A.A fterRevise, a. ackUp from TableReviseAuthor1 as A inner join TableTemp as B on B.A uthor like '%' & amp; A. eforeRevise & amp; The '%')
"PuChaDataBase. Execute strSQL
Always quote "string" invalid mode of wrong, if the strSQL string like after field between the two % a. eforeRevise instead of the fixed string (such as: "li bai"), you can run,
Access options page in the SQL SERVER is compatible with the grammar of the two options is ticked on, see below,
Consult everybody a great god, and what is wrong with where,

CodePudding user response:

Because you are spelt wrong, '%' & amp; A. eforeRevise & amp; The '%', & amp; Symbols on both sides need to double quotes not single quotes, suggest to print out strSQL see specific spell out what is the result, you'll understand when you see the results,

CodePudding user response:

You mean to change like this?
StrSQL="select * into TableTemp2 from (select B.R owID, a. eforeRevise, A.A fterRevise, a. ackUp from TableReviseAuthor1 as A inner join TableTemp as B on B.A uthor like '%" "& amp; A. eforeRevise & amp; "" % ')"
The result is that the report does not support the JOIN expression of
  • Related