久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='mtFp0'></bdo><ul id='mtFp0'></ul>
  • <i id='mtFp0'><tr id='mtFp0'><dt id='mtFp0'><q id='mtFp0'><span id='mtFp0'><b id='mtFp0'><form id='mtFp0'><ins id='mtFp0'></ins><ul id='mtFp0'></ul><sub id='mtFp0'></sub></form><legend id='mtFp0'></legend><bdo id='mtFp0'><pre id='mtFp0'><center id='mtFp0'></center></pre></bdo></b><th id='mtFp0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mtFp0'><tfoot id='mtFp0'></tfoot><dl id='mtFp0'><fieldset id='mtFp0'></fieldset></dl></div>

    <small id='mtFp0'></small><noframes id='mtFp0'>

    1. <legend id='mtFp0'><style id='mtFp0'><dir id='mtFp0'><q id='mtFp0'></q></dir></style></legend>

        <tfoot id='mtFp0'></tfoot>

        帶有子查詢(xún)錯(cuò)誤的 ADO 參數(shù)化查詢(xún)

        ADO Parameterized Queries with Subqueries Error(帶有子查詢(xún)錯(cuò)誤的 ADO 參數(shù)化查詢(xún))
        <i id='VHX9N'><tr id='VHX9N'><dt id='VHX9N'><q id='VHX9N'><span id='VHX9N'><b id='VHX9N'><form id='VHX9N'><ins id='VHX9N'></ins><ul id='VHX9N'></ul><sub id='VHX9N'></sub></form><legend id='VHX9N'></legend><bdo id='VHX9N'><pre id='VHX9N'><center id='VHX9N'></center></pre></bdo></b><th id='VHX9N'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VHX9N'><tfoot id='VHX9N'></tfoot><dl id='VHX9N'><fieldset id='VHX9N'></fieldset></dl></div>

          <tbody id='VHX9N'></tbody>

            <tfoot id='VHX9N'></tfoot>

                <bdo id='VHX9N'></bdo><ul id='VHX9N'></ul>

                  <small id='VHX9N'></small><noframes id='VHX9N'>

                  <legend id='VHX9N'><style id='VHX9N'><dir id='VHX9N'><q id='VHX9N'></q></dir></style></legend>
                • 本文介紹了帶有子查詢(xún)錯(cuò)誤的 ADO 參數(shù)化查詢(xún)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我有一個(gè)運(yùn)行 SQL Server 2012(也用 2016 測(cè)試)的舊版經(jīng)典 ASP 應(yīng)用程序,我正在嘗試切換到使用參數(shù)化查詢(xún).該站點(diǎn)的所有查詢(xún)都通過(guò)一個(gè)函數(shù)運(yùn)行,該函數(shù)將 sql 語(yǔ)句視為字符串,其中包含由問(wèn)號(hào)表示的參數(shù)以及這些參數(shù)的數(shù)組.該函數(shù)目前對(duì)參數(shù)進(jìn)行過(guò)濾,使它們成為 sql 安全的,并在執(zhí)行語(yǔ)句之前將它們放入 sql 字符串中.

                  I have a legacy classic ASP application running with SQL Server 2012 (also tested with 2016) that I am trying to switch over to using parameterized queries. All the site's queries run through a function which expects a sql statement as a string with parameters represented by question marks as well as an array of those parameters. The function currently filters the parameters to make them sql safe and puts them into the sql string before executing the statement.

                  鑒于此,我認(rèn)為將其切換為參數(shù)化查詢(xún)會(huì)非常簡(jiǎn)單.初始測(cè)試看起來(lái)不錯(cuò),一切似乎都正常工作,直到我在子查詢(xún)中遇到了帶有參數(shù)的 sql 語(yǔ)句.

                  Given this, I thought it would be pretty straightforward to switch this to parameterized queries. Initial testing looked good, and everything appeared to be working properly until I hit a sql statement with parameters in subqueries.

                  以下是有效的測(cè)試示例:

                  Here's a test sample of what works:

                  Const connectionString = "Provider=SQLNCLI11; Server=********; Database=********; UID=*******; PWD=*******"
                  
                  Dim sql, productId, parameters
                  sql = "SELECT SKU FROM Products WHERE ProductId = ?"
                  productId = 3
                  parameters = Array(productId)
                  
                  Dim conn
                  Set conn = Server.CreateObject("ADODB.Connection")
                  conn.Open connectionString
                  
                  Dim cmd
                  Set cmd = Server.CreateObject("ADODB.Command")
                  cmd.ActiveConnection = conn
                  cmd.CommandText = sql
                  cmd.Parameters.Refresh
                  
                  Dim rs
                  Set rs = cmd.Execute(, parameters)
                  
                  Response.Write("SKU: " & rs("SKU"))
                  

                  沒(méi)問(wèn)題,這會(huì)按預(yù)期返回 SKU.但是,如果我使用子查詢(xún):

                  No problem, this returns the SKU as expected. However, if I use a subquery:

                  Const connectionString = "Provider=SQLNCLI11; Server=********; Database=********; UID=*******; PWD=*******"
                  
                  Dim sql, productId, parameters
                  'contrived subquery for demonstration purposes
                  sql = "SELECT SKU FROM ( SELECT SKU FROM Products WHERE ProductId = ? ) AS P"
                  productId = 3
                  parameters = Array(productId)
                  
                  Dim conn
                  Set conn = Server.CreateObject("ADODB.Connection")
                  conn.Open connectionString
                  
                  Dim cmd
                  Set cmd = Server.CreateObject("ADODB.Command")
                  cmd.ActiveConnection = conn
                  cmd.CommandText = sql
                  cmd.Parameters.Refresh
                  
                  Dim rs
                  Set rs = cmd.Execute(, parameters)
                  
                  Response.Write("SKU: " & rs("SKU"))
                  

                  它在 cmd.Parameters.Refresh 行拋出錯(cuò)誤:

                  It throws an error on the cmd.Parameters.Refresh line:

                  Microsoft VBScript 運(yùn)行時(shí)錯(cuò)誤0x80004005"Microsoft SQL Server 本機(jī)客戶(hù)端 11.0語(yǔ)法錯(cuò)誤、權(quán)限違規(guī)或其他非特定錯(cuò)誤

                  Microsoft VBScript runtime error '0x80004005' Microsoft SQL Server Native Client 11.0 Syntax error, permission violation, or other nonspecific error

                  如果我在第一個(gè)樣本中檢查 cmd.Parameters.Count,我會(huì)正確地得到 1.在錯(cuò)誤的樣本中,它會(huì)拋出相同的錯(cuò)誤.

                  If I check cmd.Parameters.Count in the first sample, I correctly get 1. In the bad sample it throws the same error.

                  是否有任何解釋為什么將參數(shù)放入子查詢(xún)會(huì)導(dǎo)致參數(shù)集合出現(xiàn)問(wèn)題?我確實(shí)嘗試將參數(shù)手動(dòng)添加到 Parameters 集合中,效果很好,但這意味著要修改數(shù)百個(gè)現(xiàn)有的 sql 調(diào)用,因此目前 cmd.Parameters.Refresh 往返是值得的.

                  Is there any explanation as to why putting the parameter into a subquery causes problems with the parameter collection? I did try manually adding the parameter to the Parameters collection, and that works fine, but it means modifying hundreds of existing sql calls, so for the moment the cmd.Parameters.Refresh round-trip was worth the expense.

                  推薦答案

                  cmd.execute你想要什么都可以,不過(guò)我好久沒(méi)用了.

                  You can give cmd.execute what you want, but I haven't used it in a long time.

                  cmd.execute("SELECT SKU FROM ( SELECT SKU FROM Products WHERE ProductId = ? ) AS P", Array(productId))

                  cmd.execute("SELECT SKU FROM ( SELECT SKU FROM Products WHERE ProductId = ? ) AS P", Array(productId))

                  這篇關(guān)于帶有子查詢(xún)錯(cuò)誤的 ADO 參數(shù)化查詢(xún)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫(xiě) SQL 查詢(xún)的情況下找出數(shù)據(jù)庫(kù)列表和 SQL Server 實(shí)例使用的空間嗎?) - IT屋-程序員軟件開(kāi)發(fā)
                  How to create a login to a SQL Server instance?(如何創(chuàng)建對(duì) SQL Server 實(shí)例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過(guò)注冊(cè)表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會(huì)出現(xiàn)“數(shù)據(jù)類(lèi)型轉(zhuǎn)換錯(cuò)誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應(yīng)用程序設(shè)計(jì)——將文檔從 SQL Server 移動(dòng)到文件存儲(chǔ))
                  • <i id='Embiy'><tr id='Embiy'><dt id='Embiy'><q id='Embiy'><span id='Embiy'><b id='Embiy'><form id='Embiy'><ins id='Embiy'></ins><ul id='Embiy'></ul><sub id='Embiy'></sub></form><legend id='Embiy'></legend><bdo id='Embiy'><pre id='Embiy'><center id='Embiy'></center></pre></bdo></b><th id='Embiy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Embiy'><tfoot id='Embiy'></tfoot><dl id='Embiy'><fieldset id='Embiy'></fieldset></dl></div>
                    <legend id='Embiy'><style id='Embiy'><dir id='Embiy'><q id='Embiy'></q></dir></style></legend>

                        <tbody id='Embiy'></tbody>

                      <small id='Embiy'></small><noframes id='Embiy'>

                          • <bdo id='Embiy'></bdo><ul id='Embiy'></ul>
                            <tfoot id='Embiy'></tfoot>
                          • 主站蜘蛛池模板: 国产区第一页 | 超碰av人人| 青青久在线视频 | 中文字幕国产 | av天天干 | 一级黄色大片 | 91九色porny首页最多播放 | 欧美日韩一区二区三区在线观看 | www.伊人.com| 91精品国产麻豆 | 久久久久久久97 | 日韩伦理一区二区 | 日本网站免费在线观看 | 蜜桃视频在线观看www社区 | 久久国产精品久久久久久 | 成人国产一区二区三区精品麻豆 | 97国产精品视频人人做人人爱 | 国产精品日韩欧美 | 美女久久| 欧美黄色片| 久久精品国产亚洲a | 精品国产不卡一区二区三区 | h视频在线免费 | 成人在线中文字幕 | 99精品视频在线 | 久久69精品久久久久久久电影好 | 九九久久久 | 亚洲欧美精品 | 国产精品夜间视频香蕉 | 九九综合 | 91麻豆精品国产91久久久久久 | 黄色免费观看网站 | 精品欧美乱码久久久久久 | 精品国产一区二区三区观看不卡 | 青青草免费在线视频 | 久久久久久亚洲 | 亚洲精品久久久久中文字幕二区 | 中文字幕一区二区三区精彩视频 | 在线视频一区二区 | 国产精品五月天 | av片在线免费看 |