使用Excel ODBC驱动程序进行字符串比

时间:2016-09-16 12:10:59

标签: sql excel vba odbc

以下SQL查询会出现此错误:

  

“[Microsoft] [ODBC Excel驱动程序]参数太少。预计1。”

Dim adoRS As New ADODB.Recordset

adoRS.Open "SELECT CStr(BOX) AS 'STRBOX',SLOT FROM [BIOSAMPLES$] WHERE STRBOX = '" & CStr(nBoxID) & "'" & " ORDER BY SLOT", adoConn

有什么问题?

1 个答案:

答案 0 :(得分:0)

好的,我找到了解决这个愚蠢的Excel问题的方法。这是我的解决方案:

Dim adoRS As New ADODB.Recordset

adoRS.Open "SELECT BOX,SLOT FROM [BIOSAMPLES$] WHERE CStr('B' & BOX) = 'B" & CStr(nBoxID) & "'" & " ORDER BY SLOT", adoConn

干杯.-