共用方式為


SqlCeCommand 建構函式

初始化 SqlCeCommand 類別的新執行個體。

命名空間:  System.Data.SqlServerCe
組件:  System.Data.SqlServerCe (在 System.Data.SqlServerCe.dll 中)

語法

'宣告
<SecurityCriticalAttribute> _
<SecurityTreatAsSafeAttribute> _
Public Sub New
'用途

Dim instance As New SqlCeCommand()
[SecurityCriticalAttribute]
[SecurityTreatAsSafeAttribute]
public SqlCeCommand()
[SecurityCriticalAttribute]
[SecurityTreatAsSafeAttribute]
public:
SqlCeCommand()
[<SecurityCriticalAttribute>]
[<SecurityTreatAsSafeAttribute>]
new : unit -> SqlCeCommand
public function SqlCeCommand()

備註

基底建構函式會將所有欄位初始化為其預設值。下表顯示 SqlCeCommand 執行個體的初始屬性值。

屬性

初始值

CommandText

空字串 ("")

CommandType

Text

Connection

nullnull 參考 (在 Visual Basic 中為 Nothing)

範例

下列範例會建立 SqlCeCommand,並設定其部分屬性。

Dim cmd As SqlCeCommand = conn.CreateCommand()
cmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID"
cmd.CommandType = CommandType.Text
cmd.UpdatedRowSource = UpdateRowSource.Both
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID";
cmd.CommandType = CommandType.Text;
cmd.UpdatedRowSource = UpdateRowSource.Both;

請參閱

參考

SqlCeCommand 類別

SqlCeCommand 多載

System.Data.SqlServerCe 命名空間