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

      <bdo id='04n0A'></bdo><ul id='04n0A'></ul>

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

    <small id='04n0A'></small><noframes id='04n0A'>

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

    1. 在 INSERT 上返回 ID?

      Return ID on INSERT?(在 INSERT 上返回 ID?)
      <i id='u098B'><tr id='u098B'><dt id='u098B'><q id='u098B'><span id='u098B'><b id='u098B'><form id='u098B'><ins id='u098B'></ins><ul id='u098B'></ul><sub id='u098B'></sub></form><legend id='u098B'></legend><bdo id='u098B'><pre id='u098B'><center id='u098B'></center></pre></bdo></b><th id='u098B'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='u098B'><tfoot id='u098B'></tfoot><dl id='u098B'><fieldset id='u098B'></fieldset></dl></div>
          <bdo id='u098B'></bdo><ul id='u098B'></ul>

        • <legend id='u098B'><style id='u098B'><dir id='u098B'><q id='u098B'></q></dir></style></legend>
        • <tfoot id='u098B'></tfoot>

          • <small id='u098B'></small><noframes id='u098B'>

                <tbody id='u098B'></tbody>
                本文介紹了在 INSERT 上返回 ID?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我有一個 INSERT 查詢,我希望數據庫返回我剛剛插入的行的 ID.

                I have an INSERT query and I want the DB to return the ID of the row I just inserted.

                sqlString = "INSERT INTO MagicBoxes (OwnerID, Key, Name, Permissions, Active, LastUpdated) VALUES (@OwnerID, @BoxKey, @BoxName, 0, 1, @Date) SET @ID = SCOPE_IDENTITY();";
                cmd = new SqlCommand(sqlString, con);
                cmd.Parameters.AddWithValue("@OwnerID", OwnerID);
                cmd.Parameters.AddWithValue("@BoxKey", BoxKey);
                cmd.Parameters.AddWithValue("@BoxName", BoxName);
                cmd.Parameters.AddWithValue("@Username", Username);
                cmd.Parameters.AddWithValue("@Date", DateTime.Now);
                cmd.ExecuteNonQuery();
                

                我目前有這個,我不確定接下來我需要做什么......

                I currently have this, I'm not sure what I need to do next...

                推薦答案

                你只需要在params集合中添加@ID,然后像這樣檢索它,

                You just need to add @ID to the params collection and then retrieve it like this,

                cmd.Parameters.Add("@ID", SqlDbType.Int, 4).Direction = ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                //Now just read the value of: cmd.Parameters["@ID"].value
                

                或者,如果您更喜歡這種語法:

                Or, if you prefer this syntax:

                SqlParameter param = new SqlParameter("@ID", SqlDbType.Int, 4);
                param.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(param);
                

                這篇關于在 INSERT 上返回 ID?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                What are good algorithms for vehicle license plate detection?(車牌檢測有哪些好的算法?)
                onClick event for Image in Unity(Unity中圖像的onClick事件)
                Running Total C#(運行總 C#)
                Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時刪除目錄)
                asp.net listview highlight row on click(asp.net listview 在單擊時突出顯示行)
                Calling A Button OnClick from a function(從函數調用按鈕 OnClick)

                  <legend id='pmsmO'><style id='pmsmO'><dir id='pmsmO'><q id='pmsmO'></q></dir></style></legend>
                    <tfoot id='pmsmO'></tfoot>

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

                    • <bdo id='pmsmO'></bdo><ul id='pmsmO'></ul>
                    • <i id='pmsmO'><tr id='pmsmO'><dt id='pmsmO'><q id='pmsmO'><span id='pmsmO'><b id='pmsmO'><form id='pmsmO'><ins id='pmsmO'></ins><ul id='pmsmO'></ul><sub id='pmsmO'></sub></form><legend id='pmsmO'></legend><bdo id='pmsmO'><pre id='pmsmO'><center id='pmsmO'></center></pre></bdo></b><th id='pmsmO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pmsmO'><tfoot id='pmsmO'></tfoot><dl id='pmsmO'><fieldset id='pmsmO'></fieldset></dl></div>
                            <tbody id='pmsmO'></tbody>
                          主站蜘蛛池模板: 日韩国产在线 | 久久av网 | 中文字幕成人在线 | 亚洲国产区 | 久久狠狠| 中文字幕日韩三级 | 超碰免费在 | 日日操夜夜操天天操 | 精品免费 | 一本色道久久综合亚洲精品高清 | 国产日韩欧美一区 | 日韩一区二区在线观看 | 国产999精品久久久 午夜天堂精品久久久久 | 国产人成精品一区二区三 | 国产日韩一区二区 | 国产高清视频 | 国产精品久久久亚洲 | 一级欧美 | 亚洲一区二区三区在线播放 | av网站在线播放 | 中文字幕精品一区久久久久 | 日本黄色高清视频 | 人人艹人人 | 国产精品美女久久久久久免费 | 欧美三级免费观看 | 亚洲视频一区 | 第四色影音先锋 | 亚州国产 | 久久久久久91 | 国产最好的av国产大片 | 天堂成人国产精品一区 | 最新国产精品 | 成人欧美一区二区三区白人 | 亚洲欧美日韩成人在线 | 色吊丝2288sds中文字幕 | 一区二区在线 | 最新国产精品视频 | 成人欧美一区二区三区黑人孕妇 | 综合久久综合久久 | 国产精品免费一区二区三区四区 | 午夜影院在线观看 |