4
我想使用Ruby-DBI執行簡單的查詢,但所有結果都是零。 查詢應該返回6行,我已經插入到數據庫中。Ruby-DBI MSSQL - 當我嘗試創建一個選擇句子時,我只得到nils作爲結果
我的代碼:
conn = DBI.connect("DBI:ODBC:myODBC", user, password)
sql = "select S.Name, S.InternalName, from sites S where S.IsEnabled = 1"
sth = conn.select_all(sql)
while row=sth.fetch do
p row
end
conn.disconnect if conn
當我執行的結果是:
nil
nil
nil
nil
nil
nil
所以,這似乎是Ruby的DBI檢索結果6,但我不知道爲什麼所有的結果是零。 我正在運行Windows 7和Ruby 2.0.0的代碼。 32位
我試過微軟的工具:sqlrun.exe,該工具正確返回結果,所以查詢和連接設置應該沒問題。
這裏的任何光線?可能是ruby-dbi問題?