我正在尝试从sqlite数据库中获取数据。使用此Sub GetKeyVals()
' GetKeyVals Macro
' Get the key values based on the Unique customer codes
' Define sheet
Dim Extract As Worksheet
Set Extract = ActiveSheet
'Define lastRow
Dim lastRow As Long
lastRow = Extract.Cells(Rows.Count, "A").End(xlUp).row
' Loop round all rows
Dim n As Long
For n = 2 To lastRow
Cells(n, 3).FormulaR1C1 = _
"=SUMIF(SAPDump!R2C8:R1317C8,Extract!RC[-1],SAPDump!R2C10:R1317C10)*-1"
Range("C3").Select
Next n
' Insert Title
Dim Txt As Range
Set Txt = ActiveSheet.Range("C1")
Txt.Value = "KeyValue"
Txt.Font.Bold = True
End Sub
方法并且我得到了以下SqlException
context.getContentResolver().query()
这是我正在使用的代码
near ":23": syntax error (code 1): , while compiling: SELECT wol_wait, mac_addr, _id, address, name, wol_port, user, timeout, pass FROM hosts WHERE (mac_addr=00:23:15:97:ce:a0) ORDER BY name ASC
我该如何解决这个问题?
答案 0 :(得分:2)
MAC地址等字符串文字需要在'single quotes'
中,或者更好,使用?
占位符和变量绑定。取代
Hosts.MAC_ADDR +"=" +String.valueOf(mhost.mac_addr),null
与
Hosts.MAC_ADDR +"=?", new String[] { String.valueOf(mhost.mac_addr) }
可能不需要String.valueOf
。