---
product: Chilkat
product_version: 11.7.0
language: sqlserver
language_label: SQL Server
class: SCard
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/sqlserver_SCardRef.html
---
# Chilkat SCard — SQL Server — v11.7.0

> Chilkat 11.7.0 · language=sqlserver · class=SCard
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/SCard.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/sqlserver/guide.md`.

## Purpose

**Communicate directly with smart card readers and cards through PC/SC.**

`Chilkat.SCard` is the low-level PC/SC smart card interface for applications that need direct reader and card communication. It supports reader discovery, reader connection, card status checking, APDU transmission, reader-control commands, status-change monitoring, transactions, and diagnostic access to underlying PC/SC errors. Use this class when the application needs APDU-level control rather than a higher-level certificate, minidriver, or PKCS#11 abstraction.

**Reader discovery**

Enumerate available PC/SC smart card readers and identify the reader the application should use.

**Connect to cards**

Connect to a reader/card, check card presence and status, and manage the active PC/SC connection.

**Transmit APDUs**

Send APDU commands directly to the card and receive the raw response bytes and status words.

**Reader-control commands**

Issue lower-level reader control commands when supported by the reader driver and PC/SC environment.

**Status monitoring**

Monitor reader or card status changes so applications can detect card insertion, removal, or state changes.

**Transactions and diagnostics**

Use PC/SC transactions for coordinated card access and inspect detailed error information when reader or card operations fail.

**Common pattern:** Establish the PC/SC context, list readers, connect to the selected reader, check card status, transmit APDU commands, process the response bytes, and disconnect when finished. Use `Chilkat.SCard` for direct PC/SC reader and APDU-level work; use `Chilkat.ScMinidriver` for card-minidriver certificate and key-container operations, and `Chilkat.Pkcs11` for PKCS#11 token or HSM sessions.

For an extended overview, see [SCard Class Overview](https://www.chilkatsoft.com/scard_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```sql
DECLARE @hr int
DECLARE @sCard int
EXEC @hr = sp_OACreate 'Chilkat.SCard', @sCard OUT
IF @hr <> 0
BEGIN
    PRINT 'Failed to create ActiveX component'
    RETURN
END

-- ... use @sCard ...

EXEC @hr = sp_OADestroy @sCard
```

T-SQL uses the Chilkat ActiveX through the OLE Automation stored procedures. They must be enabled once on the server (`EXEC sp_configure 'Ole Automation Procedures', 1; RECONFIGURE;`), and the Chilkat ActiveX registered must match the bitness of the SQL Server instance (64-bit for a 64-bit SQL Server). To bind to a specific major version of Chilkat, append the major version number to the ProgID, such as `sp_OACreate 'Chilkat.SCard.11'` for Chilkat v11.\*.\*.

`sp_OACreate` returns an object token (an `int`) that is passed as the first argument of every `sp_OAMethod`, `sp_OAGetProperty` and `sp_OASetProperty` call, and released with `sp_OADestroy`. Objects returned by methods (such as an `HttpResponse` or `JsonObject`) are also tokens received through an `int` OUT parameter; they must likewise be destroyed, and the OUT parameter is `NULL` when the method fails to return an object. Objects passed as arguments are passed by their token. When an OLE Automation procedure itself fails (non-zero `@hr`), `sp_OAGetErrorInfo` describes the error.

Data types: strings are `nvarchar(4000)`; integers, booleans (1 or 0) and object tokens are `int`; dates are `datetime`. In the signatures on this page, `@success`, `@iResult`, `@sResult` and the like are the OUT variables receiving a method's return value, `@iValue` / `@sValue` receive or supply a property value, and the remaining `@` variables are the method's arguments in order.

A string returned through an OUT parameter is limited to 4000 characters. For longer values, retrieve the result as a result set into a table variable instead of an OUT parameter, for example `DECLARE @tmp TABLE (outputLine ntext)` followed by `INSERT INTO @tmp EXEC sp_OAGetProperty @sCard, 'LastErrorText'`. See [string length limitations for strings returned by sp_OAMethod calls](https://www.chilkatsoft.com/sql_server_nvarchar_max_limitation.asp).

Methods that pass or return raw byte arrays are not shown on this page, because `varbinary(max)` values cannot be exchanged through `sp_OAMethod` (see [varbinary(max) limitation](https://www.chilkatsoft.com/sql_server_varbinary_max_limitation.asp)). Use the `BinData`-based alternatives (methods ending in *Bd*) or the base64 / hex string-encoded variants instead. Binary *properties* (such as `LastBinaryResult`) can be retrieved as a result set into a table variable, as shown in their signatures. Asynchronous (*\*Async*) methods and event callbacks are not available from SQL Server.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in SQL Server.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `EXEC sp_OAGetProperty @sCard, 'DebugLogFilePath', @sValue OUT EXEC sp_OASetProperty @sCard, 'DebugLogFilePath', @sValue` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastBinaryResult` | `INSERT INTO @tmp EXEC sp_OAGetProperty @sCard, 'LastBinaryResult'` | read-only | This property is mainly used in SQL Server stored procedures to retrieve binary data from the last method call that returned binary data. |
| `LastErrorHtml` | `EXEC sp_OAGetProperty @sCard, 'LastErrorHtml', @sValue OUT` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `EXEC sp_OAGetProperty @sCard, 'LastErrorText', @sValue OUT` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `EXEC sp_OAGetProperty @sCard, 'LastErrorXml', @sValue OUT` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `EXEC sp_OAGetProperty @sCard, 'LastMethodSuccess', @iValue OUT EXEC sp_OASetProperty @sCard, 'LastMethodSuccess', @iValue` | read/write | Indicates the success or failure of the most recent method call: `1` means success, `0` means failure. |
| `LastStringResult` | `EXEC sp_OAGetProperty @sCard, 'LastStringResult', @sValue OUT` | read-only | In SQL Server stored procedures, this property holds the string return value of the most recent method call that returns a string. |
| `LastStringResultLen` | `EXEC sp_OAGetProperty @sCard, 'LastStringResultLen', @iValue OUT` | read-only | The length, in characters, of the string contained in the LastStringResult property. |
| `VerboseLogging` | `EXEC sp_OAGetProperty @sCard, 'VerboseLogging', @iValue OUT EXEC sp_OASetProperty @sCard, 'VerboseLogging', @iValue` | read/write | If set to `1`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `EXEC sp_OAGetProperty @sCard, 'Version', @sValue OUT` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `ActiveProtocol` | property, read-only | `EXEC sp_OAGetProperty @sCard, 'ActiveProtocol', @sValue OUT` |
| `CardAtr` | property, read-only | `EXEC sp_OAGetProperty @sCard, 'CardAtr', @sValue OUT` |
| `ConnectedReader` | property, read-only | `EXEC sp_OAGetProperty @sCard, 'ConnectedReader', @sValue OUT` |
| `Context` | property, read-only | `EXEC sp_OAGetProperty @sCard, 'Context', @sValue OUT` |
| `PcscLibPath` | property, read/write | `EXEC sp_OAGetProperty @sCard, 'PcscLibPath', @sValue OUT EXEC sp_OASetProperty @sCard, 'PcscLibPath', @sValue` |
| `ReaderStatus` | property, read-only | `EXEC sp_OAGetProperty @sCard, 'ReaderStatus', @sValue OUT` |
| `ScardError` | property, read-only | `EXEC sp_OAGetProperty @sCard, 'ScardError', @sValue OUT` |
| `BeginTransaction` | method | `EXEC sp_OAMethod @sCard, 'BeginTransaction', @success OUT` |
| `CheckStatus` | method | `EXEC sp_OAMethod @sCard, 'CheckStatus', @success OUT` |
| `Connect` | method | `EXEC sp_OAMethod @sCard, 'Connect', @success OUT, @reader, @shareMode, @preferredProtocol` |
| `Disconnect` | method | `EXEC sp_OAMethod @sCard, 'Disconnect', @success OUT, @disposition` |
| `EndTransaction` | method | `EXEC sp_OAMethod @sCard, 'EndTransaction', @success OUT, @disposition` |
| `EstablishContext` | method | `EXEC sp_OAMethod @sCard, 'EstablishContext', @success OUT, @scope` |
| `FindSmartcards` | method | `EXEC sp_OAMethod @sCard, 'FindSmartcards', @success OUT, @json` |
| `GetAttrib` | method | `EXEC sp_OAMethod @sCard, 'GetAttrib', @success OUT, @attr, @bd` |
| `GetAttribStr` | method | `EXEC sp_OAMethod @sCard, 'GetAttribStr', @sResult OUT, @attr` |
| `GetAttribUint` | method | `EXEC sp_OAMethod @sCard, 'GetAttribUint', @iResult OUT, @attr` |
| `GetStatusChange` | method | `EXEC sp_OAMethod @sCard, 'GetStatusChange', @success OUT, @maxWaitMs, @stReaderNames, @json` |
| `GetStatusChangeCancel` | method | `EXEC sp_OAMethod @sCard, 'GetStatusChangeCancel', @success OUT` |
| `ListReaderGroups` | method | `EXEC sp_OAMethod @sCard, 'ListReaderGroups', @success OUT, @readerGroups` |
| `ListReaders` | method | `EXEC sp_OAMethod @sCard, 'ListReaders', @success OUT, @st` |
| `Reconnect` | method | `EXEC sp_OAMethod @sCard, 'Reconnect', @success OUT, @shareMode, @preferredProtocol, @action` |
| `ReleaseContext` | method | `EXEC sp_OAMethod @sCard, 'ReleaseContext', @success OUT` |
| `SendControl` | method | `EXEC sp_OAMethod @sCard, 'SendControl', @success OUT, @controlCode, @bdSend, @bdRecv` |
| `SendControlHex` | method | `EXEC sp_OAMethod @sCard, 'SendControlHex', @success OUT, @controlCode, @sendData, @bdRecv` |
| `Transmit` | method | `EXEC sp_OAMethod @sCard, 'Transmit', @success OUT, @protocolName, @bdSend, @bdRecv, @maxRecvLen` |
| `TransmitHex` | method | `EXEC sp_OAMethod @sCard, 'TransmitHex', @success OUT, @protocolName, @apduHex, @bdRecv, @maxRecvLen` |

## Properties

### SCard.ActiveProtocol

`Chilkat 11.7.0 · sqlserver · SCard · ActiveProtocol · property · read-only · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'ActiveProtocol', @sValue OUT
```

The name of the active protocol if connected smart card reader, or an empty string if not connected. Possible values are `T0`, `T1`, `raw`, `undefined`, or if not connected to a reader.

### SCard.CardAtr

`Chilkat 11.7.0 · sqlserver · SCard · CardAtr · property · read-only · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'CardAtr', @sValue OUT
```

This is the Current ATR of a card in the connected reader.

### SCard.ConnectedReader

`Chilkat 11.7.0 · sqlserver · SCard · ConnectedReader · property · read-only · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'ConnectedReader', @sValue OUT
```

The name of the currently connected smart card reader, or an empty string if not connected.

### SCard.Context

`Chilkat 11.7.0 · sqlserver · SCard · Context · property · read-only · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'Context', @sValue OUT
```

Contains the string `user` or `system` if this object has established a context (by calling EstablishContext). Contains the empty string if no context is established.

### SCard.PcscLibPath

`Chilkat 11.7.0 · sqlserver · SCard · PcscLibPath · property · read/write · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'PcscLibPath', @sValue OUT
EXEC sp_OASetProperty @sCard, 'PcscLibPath', @sValue
```

For Linux systems only. Specifies the full path of the libpcsclite.so shared lib. This property should only be used if the libpcsclite.so is in a non-standard location or if Chilkat cannot automatically located it.

### SCard.ReaderStatus

`Chilkat 11.7.0 · sqlserver · SCard · ReaderStatus · property · read-only · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'ReaderStatus', @sValue OUT
```

The current status of the connected reader. Possible values are:

- `absent` - There is no card in the reader.
- `present` - There is a card in the reader, but it has not been moved into position for use.
- `swallowed` - There is a card in the reader in position for use. The card is not powered.
- `powered` - Power is being provided to the card, but the reader driver is unaware of the mode of the card.
- `negotiable` - The card has been reset and is awaiting PTS negotiation.
- `specific` - The card has been reset and specific communication protocols have been established.

### SCard.ScardError

`Chilkat 11.7.0 · sqlserver · SCard · ScardError · property · read-only · since 9.50.87`

```sql
EXEC sp_OAGetProperty @sCard, 'ScardError', @sValue OUT
```

The last error returned by an underlying PC/SC function. Can be one of the following:

- `SCARD_W_REMOVED_CARD` - The smart card has been removed, so that further communication is not possible.
- `SCARD_W_RESET_CARD` - The smart card has been reset, so any shared state information is invalid.
...

## Methods

### SCard.BeginTransaction

`Chilkat 11.7.0 · sqlserver · SCard · BeginTransaction · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'BeginTransaction', @success OUT
```

Establishes a temporary exclusive access mode for doing a series of commands in a transaction.

Returns 1 for success, 0 for failure.

### SCard.CheckStatus

`Chilkat 11.7.0 · sqlserver · SCard · CheckStatus · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'CheckStatus', @success OUT
```

Check the current status of the currently connected reader. Calling this method updates the ReaderStatus, ActiveProtocol, and CardAtr properties. If this method returns `0`, none of the properties are updated.

Returns 1 for success, 0 for failure.

### SCard.Connect

`Chilkat 11.7.0 · sqlserver · SCard · Connect · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'Connect', @success OUT, @reader, @shareMode, @preferredProtocol
```

Establish a connection to a reader. The `reader` is the name of a reader returned from ListReaders. The `shareMode` can be `shared`, `exclusive`, or `direct`. The `preferredProtocol` can be `0` (valid only if the shareMode = `direct`), `T0`, `T1`, `raw`, or `no_preference`. (No preference is effectively T0 or T1.)

If successful, the state of this object instance is that it's connected to the reader.

Returns 1 for success, 0 for failure.

### SCard.Disconnect

`Chilkat 11.7.0 · sqlserver · SCard · Disconnect · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'Disconnect', @success OUT, @disposition
```

Terminates a connection with a reader. The `disposition` can be one of the following values:

- `leave`: Do nothing.
- `reset`: Reset the card (warm reset).
- `unpower`: Power down the card (cold reset).
- `eject`: Eject the card.

Returns 1 for success, 0 for failure.

### SCard.EndTransaction

`Chilkat 11.7.0 · sqlserver · SCard · EndTransaction · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'EndTransaction', @success OUT, @disposition
```

Ends a previously begun transaction. The `disposition` is the action to be taken on the reader, and can be `leave` which is to do nothing, `reset`, `unpower`, or `eject`.

Returns 1 for success, 0 for failure.

### SCard.EstablishContext

`Chilkat 11.7.0 · sqlserver · SCard · EstablishContext · method · since 9.5.0.87`

```sql
EXEC sp_OAMethod @sCard, 'EstablishContext', @success OUT, @scope
```

Creates an Application Context to the PC/SC Resource Manager. This must be the first WinSCard function called in a PC/SC application. The `scope` can be `user` or `system`. After calling, this object will have context and all other methods will use the established context. The `Context` property will hold the value `user` or `system` if context was established, or will be empty if no context was established.

Returns 1 for success, 0 for failure.

### SCard.FindSmartcards

`Chilkat 11.7.0 · sqlserver · SCard · FindSmartcards · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'FindSmartcards', @success OUT, @json
```

Returns JSON containing information about the smartcards currently inserted into readers.

Returns 1 for success, 0 for failure.

### SCard.GetAttrib

`Chilkat 11.7.0 · sqlserver · SCard · GetAttrib · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'GetAttrib', @success OUT, @attr, @bd
```

Get an attribute from the IFD Handler (reader driver).

The `attr` can be one of the following:

- `ASYNC_PROTOCOL_TYPES`
- `ATR_STRING`
- `CHANNEL_ID`
- `CHARACTERISTICS`
- `CURRENT_BWT`
- `CURRENT_CLK`
- `CURRENT_CWT`
- `CURRENT_D`
- `CURRENT_EBC_ENCODING`
- `CURRENT_F`
- `CURRENT_IFSC`
- `CURRENT_IFSD`
- `CURRENT_IO_STATE`
- `CURRENT_N`
- `CURRENT_PROTOCOL_TYPE`
- `CURRENT_W`
- `DEFAULT_CLK`
- `DEFAULT_DATA_RATE`
- `DEVICE_FRIENDLY_NAME`
- `DEVICE_IN_USE`
- `DEVICE_SYSTEM_NAME`
- `DEVICE_UNIT`
- `ESC_AUTHREQUEST`
- `ESC_CANCEL`
- `ESC_RESET`
- `EXTENDED_BWT`
- `ICC_INTERFACE_STATUS`
- `ICC_PRESENCE`
- `ICC_TYPE_PER_ATR`
- `MAX_CLK`
- `MAX_DATA_RATE`
- `MAX_IFSD`
- `MAXINPUT`
- `POWER_MGMT_SUPPORT`
- `SUPRESS_T1_IFS_REQUEST`
- `SYNC_PROTOCOL_TYPES`
- `USER_AUTH_INPUT_DEVICE`
- `USER_TO_CARD_AUTH_DEVICE`
- `VENDOR_IFD_SERIAL_NO`
- `VENDOR_IFD_TYPE`
- `VENDOR_IFD_VERSION`
- `VENDOR_NAME`

The attribute data is returned in `bd`.

Returns 1 for success, 0 for failure.

### SCard.GetAttribStr

`Chilkat 11.7.0 · sqlserver · SCard · GetAttribStr · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'GetAttribStr', @sResult OUT, @attr
```

Get a string typed attribute from the IFD Handler (reader driver).

The `attr` can be one of the following, but should be limited to the particular attributes that return string values.

- `ASYNC_PROTOCOL_TYPES`
- `ATR_STRING`
- `CHANNEL_ID`
- `CHARACTERISTICS`
- `CURRENT_BWT`
- `CURRENT_CLK`
- `CURRENT_CWT`
- `CURRENT_D`
- `CURRENT_EBC_ENCODING`
- `CURRENT_F`
- `CURRENT_IFSC`
- `CURRENT_IFSD`
- `CURRENT_IO_STATE`
- `CURRENT_N`
- `CURRENT_PROTOCOL_TYPE`
- `CURRENT_W`
- `DEFAULT_CLK`
- `DEFAULT_DATA_RATE`
- `DEVICE_FRIENDLY_NAME`
- `DEVICE_IN_USE`
- `DEVICE_SYSTEM_NAME`
- `DEVICE_UNIT`
- `ESC_AUTHREQUEST`
- `ESC_CANCEL`
- `ESC_RESET`
- `EXTENDED_BWT`
- `ICC_INTERFACE_STATUS`
- `ICC_PRESENCE`
- `ICC_TYPE_PER_ATR`
- `MAX_CLK`
- `MAX_DATA_RATE`
- `MAX_IFSD`
- `MAXINPUT`
- `POWER_MGMT_SUPPORT`
- `SUPRESS_T1_IFS_REQUEST`
- `SYNC_PROTOCOL_TYPES`
- `USER_AUTH_INPUT_DEVICE`
- `USER_TO_CARD_AUTH_DEVICE`
- `VENDOR_IFD_SERIAL_NO`
- `VENDOR_IFD_TYPE`
- `VENDOR_IFD_VERSION`
- `VENDOR_NAME`

Returns `NULL` on failure

### SCard.GetAttribUint

`Chilkat 11.7.0 · sqlserver · SCard · GetAttribUint · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'GetAttribUint', @iResult OUT, @attr
```

Get an unsigned integer typed attribute from the IFD Handler (reader driver).

The `attr` can be one of the following, but should be limited to the particular attributes that return unsigned integer values.

- `ASYNC_PROTOCOL_TYPES`
- `ATR_STRING`
- `CHANNEL_ID`
- `CHARACTERISTICS`
- `CURRENT_BWT`
- `CURRENT_CLK`
- `CURRENT_CWT`
- `CURRENT_D`
- `CURRENT_EBC_ENCODING`
- `CURRENT_F`
- `CURRENT_IFSC`
- `CURRENT_IFSD`
- `CURRENT_IO_STATE`
- `CURRENT_N`
- `CURRENT_PROTOCOL_TYPE`
- `CURRENT_W`
- `DEFAULT_CLK`
- `DEFAULT_DATA_RATE`
- `DEVICE_FRIENDLY_NAME`
- `DEVICE_IN_USE`
- `DEVICE_SYSTEM_NAME`
- `DEVICE_UNIT`
- `ESC_AUTHREQUEST`
- `ESC_CANCEL`
- `ESC_RESET`
- `EXTENDED_BWT`
- `ICC_INTERFACE_STATUS`
- `ICC_PRESENCE`
- `ICC_TYPE_PER_ATR`
- `MAX_CLK`
- `MAX_DATA_RATE`
- `MAX_IFSD`
- `MAXINPUT`
- `POWER_MGMT_SUPPORT`
- `SUPRESS_T1_IFS_REQUEST`
- `SYNC_PROTOCOL_TYPES`
- `USER_AUTH_INPUT_DEVICE`
- `USER_TO_CARD_AUTH_DEVICE`
- `VENDOR_IFD_SERIAL_NO`
- `VENDOR_IFD_TYPE`
- `VENDOR_IFD_VERSION`
- `VENDOR_NAME`

Returns 0xFFFFFFFF on failure.

### SCard.GetStatusChange

`Chilkat 11.7.0 · sqlserver · SCard · GetStatusChange · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'GetStatusChange', @success OUT, @maxWaitMs, @stReaderNames, @json
```

Blocks execution until the current availability of the cards in a specific set of readers changes.

This function receives a list of reader names in `stReaderNames`. It then blocks waiting for a change in state to occur for a maximum blocking time of `maxWaitMs` (in milliseconds) or forever if 0 is used.

Information about the current reader states and which reader(s) changed is returned in `json`. See the example below for more information.

To wait for a reader event (reader added or removed) you may use the special reader name `\\?PnP?\Notification`.

To cancel the ongoing call, call Cancel().

The `stReaderNames` contains the reader names to check. The `json` is empty on input, and if the call returns success contains information about the state (after the event change) of each reader.

Returns 1 for success, 0 for failure.

### SCard.GetStatusChangeCancel

`Chilkat 11.7.0 · sqlserver · SCard · GetStatusChangeCancel · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'GetStatusChangeCancel', @success OUT
```

Cancels an ongoing GetStatusChange method call. This would be called from a separate thread in your application if GetStatusChange was called synchronously.

Returns 1 for success, 0 for failure.

### SCard.ListReaderGroups

`Chilkat 11.7.0 · sqlserver · SCard · ListReaderGroups · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'ListReaderGroups', @success OUT, @readerGroups
```

Returns a list of currently available reader groups on the system. The reader groups are returned in `readerGroups`.

Returns 1 for success, 0 for failure.

### SCard.ListReaders

`Chilkat 11.7.0 · sqlserver · SCard · ListReaders · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'ListReaders', @success OUT, @st
```

Returns a list of currently available readers on the system.

Returns 1 for success, 0 for failure.

### SCard.Reconnect

`Chilkat 11.7.0 · sqlserver · SCard · Reconnect · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'Reconnect', @success OUT, @shareMode, @preferredProtocol, @action
```

Reestablishes a connection to a reader that was previously connected to using Connect().

In a multi application environment it is possible for an application to reset the card in shared mode. When this occurs any other application trying to access certain commands will be returned the value SCARD_W_RESET_CARD. When this occurs Reconnect() must be called in order to acknowledge that the card was reset and allow it to change its state accordingly.

The `shareMode` can be `shared`, `exclusive`, or `direct`. The `preferredProtocol` can be `0` (valid only if the shareMode = `direct`), `T0`, `T1`, `raw`, or `no_preference`. (No preference is effectively T0 or T1.) The `action` is the desired action taken on the card/reader. It can be `leave`, `reset`, `unpower`, or `eject`.

If successful, the state of this object instance is that it's connected to the reader.

Returns 1 for success, 0 for failure.

### SCard.ReleaseContext

`Chilkat 11.7.0 · sqlserver · SCard · ReleaseContext · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'ReleaseContext', @success OUT
```

Destroys a communication context to the PC/SC Resource Manager. This must be the last function called in a PC/SC application.

Returns 1 for success, 0 for failure.

### SCard.SendControl

`Chilkat 11.7.0 · sqlserver · SCard · SendControl · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'SendControl', @success OUT, @controlCode, @bdSend, @bdRecv
```

Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.

This is useful for creating client side reader drivers for functions like PIN pads, biometrics, or other extensions to the normal smart card reader that are not normally handled by PC/SC.

The command data is sent in `bdSend`. The response is written to `bdRecv`.

Returns 1 for success, 0 for failure.

### SCard.SendControlHex

`Chilkat 11.7.0 · sqlserver · SCard · SendControlHex · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'SendControlHex', @success OUT, @controlCode, @sendData, @bdRecv
```

Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.

This is useful for creating client side reader drivers for functions like PIN pads, biometrics, or other extensions to the normal smart card reader that are not normally handled by PC/SC.

The command data is provided as a hex string in `sendData`. The response is written to `bdRecv`.

Returns 1 for success, 0 for failure.

### SCard.Transmit

`Chilkat 11.7.0 · sqlserver · SCard · Transmit · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'Transmit', @success OUT, @protocolName, @bdSend, @bdRecv, @maxRecvLen
```

Sends an APDU to the smart card contained in the currently connected reader. The `protocolName` can be `T0`, `T1`, or `raw`. The APDU to be sent is contained in `bdSend`. The response from the card is contained in `bdRecv`. The `maxRecvLen` is the maximum response size (in bytes) willing to be accepted.

Returns 1 for success, 0 for failure.

### SCard.TransmitHex

`Chilkat 11.7.0 · sqlserver · SCard · TransmitHex · method · since 9.50.87`

```sql
EXEC sp_OAMethod @sCard, 'TransmitHex', @success OUT, @protocolName, @apduHex, @bdRecv, @maxRecvLen
```

Sends an APDU to the smart card contained in the currently connected reader. The `protocolName` can be `T0`, `T1`, or `raw`. The APDU (in hexadecimal) to be sent is passed in `apduHex`. The response from the card is contained in `bdRecv`. The `maxRecvLen` is the maximum response size (in bytes) willing to be accepted.

Returns 1 for success, 0 for failure.

## Events and callbacks

This binding has no event callbacks.

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/sqlserver/classes/BinData.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/sqlserver/classes/JsonObject.md), [`StringTable`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/sqlserver/classes/StringTable.md)

