ADO.NET之3-Command對象---ShinePans

來源:互聯網
上載者:User

標籤:使用   io   資料   cti   ar   時間   資料庫   sql   

Command對象可以分成4種,SqlCommand,OleDbComman,OlbcCommand,OracleComman 


屬性
說明
CommandType 擷取或設定Command對象要執行命令的類型
CommandText 擷取或設定要對資料來源執行的SQL語句或預存程序名或表名
CommandTimeOut 擷取或設定在終止對執行命令的嘗試並建置錯誤之前的等待時間
Connection 擷取或設定Command對象使用的Connection對象的名稱
Parameters 擷取Command對象需要使用的參數集合

CommandType枚舉成員

成員名 說明
Text SQL文本命令
StoredProcedure 預存程序的名稱
TableDirect 表的名稱

SqlCommand常用的方法

方法 說明
ExecuteNonQuery             用於執行非SELECT命令,如INSERT,DELETE,UPDATE,返回受影響的資料行數,也可以建立,更新,刪除資料庫物件
ExecuteScalar 用於執行SELECT查詢命令,返回資料中第一行第一列的值,該方法通常用來執行那些用到COUNT或SUM函數的SELECT命令
ExecuteReader 執行SELECT命令,並返回一個DataReader對象,這個DataReader對象是一個唯讀向前的資料集

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.