看板 Web_Design 關於我們 聯絡資訊
我有一個字串依照","分隔 使用split切割 切割後想放入 where in (?)查詢 但都會出現... [多重步驟OLE DB操作發生錯誤。 請檢查每一個可用的OLE DB 狀態值。尚未完成任何操作] 我的部分程式碼如下.. <!-- #include file="barcodedb.asp" --> testkk=clch(Request("testkk")) itemArr=split(testkk,",") set cmd = server.createobject("ADODB.Command") With cmd .ActiveConnection= dconn .CommandType=1 .NamedParameters=True end with sql ="select * from data1 where SerialNo in (?) " int x=0 for each ite in itemArr strParamName = cstr("SerialNo"& x) cmd.Parameters.Append cmd.CreateParameter("@"+strParamName,200,1,50) cmd.Parameters("@"+strParamName).Value=ite x=x+1 Next Set RS = Server.CreateObject ("ADODB.Recordset") cmd.CommandText=sql RS.Open cmd, ,3,4 cmd.cancel set cmd.activeConnection = nothing set cmd = nothing 執行程式後會出現開頭說的錯誤 並指向 [RS.Open cmd, ,3,4]該行 不曉得這該如何解? 要請各位神人幫忙了 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.64.226.211 ※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1508462826.A.483.html
tx50xyz: 你可以先吧sql列印出來貼到sql上,好像sql語法不對 10/21 07:18