我正在将excel文件提取到我的项目中,一切正常但不是我已经抓住了包含WMI的所有单元格。我在使用stbQuery时遇到问题,任何人都知道抓取仅包含某些字符的信息的正确语法。
OleDbConnection con = new OleDbConnection ("provider=Microsoft.Jet.OLEDB.4.0;data source=" + txtFileName.Text + ";Extended Properties=Excel 8.0;");
StringBuilder stbQuery = new StringBuilder();
stbQuery.Append("Select [Wireless Number (uneditable)], [* Last Name] FROM [" + txtSheets.Text + "$] WHERE [* Last Name] = LIKE '%WMI%' ");
答案 0 :(得分:0)
This is an SQL Syntax - LIKE Issue.
The LIKE
Keyword doesn't need an =
in Structured Query Language.
Example:
SELECT * FROM Customers
WHERE [* Last Name] LIKE 's%';
UPDATE
Look at D Stanley Comment.