Microsoft.Data.Tools.TdsLib
0.2.2089.23
Prefix Reserved
dotnet add package Microsoft.Data.Tools.TdsLib --version 0.2.2089.23
NuGet\Install-Package Microsoft.Data.Tools.TdsLib -Version 0.2.2089.23
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Data.Tools.TdsLib" Version="0.2.2089.23" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Data.Tools.TdsLib" Version="0.2.2089.23" />
<PackageReference Include="Microsoft.Data.Tools.TdsLib" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Data.Tools.TdsLib --version 0.2.2089.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.Data.Tools.TdsLib, 0.2.2089.23"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Data.Tools.TdsLib@0.2.2089.23
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Data.Tools.TdsLib&version=0.2.2089.23
#tool nuget:?package=Microsoft.Data.Tools.TdsLib&version=0.2.2089.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Microsoft.Data.Tools.TdsLib
Open implementation of the TDS protocol (version 7.4) in managed C# code. It is not a full implementation, current support is focused on the login steps and some generic TDS features. It does not support normal data streams or T-SQL commands.
This library is mainly used for probing and for diagnosing TDS connections but can be used to manually construct and handle any step of a TDS connection. It can also be used to mock TDS clients.
Example
Establish a TDS connection and login to a SQL server
using Microsoft.Data.Tools.TdsLib;
using Microsoft.Data.Tools.TdsLib.IO.Connection.Tcp;
using Microsoft.Data.Tools.TdsLib.Messages;
using Microsoft.Data.Tools.TdsLib.Packets;
using Microsoft.Data.Tools.TdsLib.Payloads.Login7;
using Microsoft.Data.Tools.TdsLib.Payloads.PreLogin;
using Microsoft.Data.Tools.TdsLib.Tokens.Error;
string hostname = "sqlserver.contoso.net";
int port = 1433;
using TdsClient client = new TdsClient(new TcpServerEndpoint(hostname, port));
// Send PreLogin message
await client.MessageHandler.SendMessage(new Message(PacketType.PreLogin)
{
Payload = new PreLoginPayload(encrypt: true)
});
// Receive PreLogin message
var preLoginResponseMessage = await client.MessageHandler.ReceiveMessage(b => new PreLoginPayload(b));
// Perform TLS handshake
await client.PerformTlsHandshake();
// Prepare Login7 message
Login7Payload login7Payload = new Login7Payload()
{
Hostname = hostname,
ServerName = "MyServerName",
AppName = "MyAppName",
Language = "us_english",
Database = "MyDatabaseName",
//Username,
//Password
};
login7Payload.TypeFlags.AccessIntent = OptionAccessIntent.ReadWrite;
Message login7Message = new Message(PacketType.Login7) { Payload = login7Payload };
// Send Login7 message
await client.MessageHandler.SendMessage(login7Message);
// Receive Login response tokens
await client.TokenStreamHandler.ReceiveTokensAsync(tokenEvent =>
{
if (tokenEvent.Token is ErrorToken errorToken)
{
// Error was received from the server
}
});
// If no error token was received, and SQL server did not close the connection, then the connection to the server is now established and the user is logged in.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.2089.23 | 12,690 | 9/21/2022 |