Tüm Ürünler
Search
Belge Merkezi

Tablestore:Delete a single row

Son Güncelleme:Oct 02, 2026

.NET SDK kullanarak Tablestore tablosundan tek bir satır silin.

Ön koşullar

Initialize Tablestore Client

Yöntem

public DeleteRowResponse DeleteRow(DeleteRowRequest request)

Eşzamansız yöntem:

public Task<DeleteRowResponse> DeleteRowAsync(DeleteRowRequest request)

DeleteRowRequest parametreleri

Parametre

Tür

Açıklama

tableName (Gerekli)

string

Tablonun adı.

primaryKey (Gerekli)

PrimaryKey

Birincil anahtar sütunlarının adları ve değerleri.

  • Birincil anahtar sütununun veri türü STRING, INTEGER veya BINARY olmalıdır.

  • Birincil anahtar sütunlarının sayısı ve veri türleri tablo şemasıyla eşleşmelidir.

condition (Gerekli)

Condition

Silme işlemi için koşul. Daha fazla bilgi için bkz. koşullu güncelleme.

Örnek kod

Aşağıdaki örnek, test_table tablosundan birincil anahtar değeri "row1" olan satırı siler.

try
{
    // Construct the primary key.
    PrimaryKey primaryKey = new PrimaryKey
    {
        { "id", new ColumnValue("row1") }
    };
    // A condition is required to delete a row. RowExistenceExpectation.IGNORE indicates that the operation proceeds without checking if the row exists.
    Condition condition = new Condition(RowExistenceExpectation.IGNORE);

    // Send the request to delete the row.
    DeleteRowRequest deleteRowRequest = new DeleteRowRequest("test_table", condition, primaryKey);
    DeleteRowResponse deleteRowResponse = client.DeleteRow(deleteRowRequest);
    Console.WriteLine($"RequestId: {deleteRowResponse.RequestID}");
    Console.WriteLine($"Read CU Cost: {deleteRowResponse.ConsumedCapacityUnit.Read}");
    Console.WriteLine($"Write CU Cost: {deleteRowResponse.ConsumedCapacityUnit.Write}");
}
catch (Exception ex)
{
    Console.WriteLine($"Delete row failed, exception: {ex.Message}");
}

İlgili bilgiler

Batch write data