---
title: "Remove a Per-Database Connection String"
url: "https://docs.ravendb.net/7.2/integrations/connection-strings/per-database/remove-connection-string"
version: "7.2"
language: "csharp"
---

# Remove a Per-Database Connection String

> Client language: C#. Also available for [Java](https://docs.ravendb.net/7.2/integrations/connection-strings/per-database/remove-connection-string.java.md), [Node.js](https://docs.ravendb.net/7.2/integrations/connection-strings/per-database/remove-connection-string.nodejs.md), [Python](https://docs.ravendb.net/7.2/integrations/connection-strings/per-database/remove-connection-string.python.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

> **Note**
>
> - Use `RemoveConnectionStringOperation` to remove a per-database connection string from the current database.
>
> - A connection string **cannot** be removed while it is still used by an ongoing task.  
>   Before removing it, delete the task or update it to use a different connection string.
>
> - This operation **cannot** remove inherited server-wide connection strings.  
>   To remove a cluster-level definition, use [Remove a server-wide connection string](https://docs.ravendb.net/7.2/integrations/connection-strings/server-wide/remove-connection-string.md).
>
> - To remove a per-database connection string from Studio, open **Settings > Connection Strings** and use the remove action in the list view.
>   See [Managing per-database connection strings](https://docs.ravendb.net/7.2/integrations/connection-strings/per-database/overview.md#managing-per-database-connection-strings).
>
> - In this article:
>   - [Remove a per-database connection string](#remove-a-per-database-connection-string)
>   - [Syntax](#syntax)

## Remove a per-database connection string {#remove-a-per-database-connection-string}

The following example removes a RavenDB per-database connection string.  
Only the `Name` property is required; the type is inferred from the connection string class.

### Sync

```csharp
var ravenConnectionString = new RavenConnectionString()
{
    // Note:
    // Only the 'Name' property of the connection string is needed for the remove operation.
    // Other properties are not considered.
    Name = "ravendb-connection-string-name"
};
               
// Define the remove connection string operation,
// pass the connection string to be removed.
var removeConStrOp
    = new RemoveConnectionStringOperation<RavenConnectionString>(ravenConnectionString);

// Execute the operation by passing it to Maintenance.Send
store.Maintenance.Send(removeConStrOp);
```

### Async

```csharp
var ravenConnectionString = new RavenConnectionString()
{
    // Note:
    // Only the 'Name' property of the connection string is needed for the remove operation.
    // Other properties are not considered.
    Name = "ravendb-connection-string-name"
};
               
// Define the remove connection string operation,
// pass the connection string to be removed.
var removeConStrOp
    = new RemoveConnectionStringOperation<RavenConnectionString>(ravenConnectionString);

// Execute the operation by passing it to Maintenance.SendAsync
await store.Maintenance.SendAsync(removeConStrOp);
```

## Syntax {#syntax}

```csharp
public RemoveConnectionStringOperation(T connectionString) where T : ConnectionString
```

| Parameter | Type | Description |
| - | - | - |
| **connectionString** | `T` | Connection string to remove (only `Name` is required):<br />`RavenConnectionString`<br />`SqlConnectionString`<br />`SnowflakeConnectionString`<br />`OlapConnectionString`<br />`ElasticSearchConnectionString`<br />`QueueConnectionString`<br />`AiConnectionString` |

| Return value | Description |
| - | - |
| `RemoveConnectionStringResult` | Contains `RaftCommandIndex` - the Raft index assigned to the operation. |
