This page is likely outdated (last edited on 15 Jan 2006). Visit the new documentation for updated content.

TDS Generic

  • ADO.NET Provider for old Sybase and Microsoft SQL Server databases

  • Provider is no longer maintained

  • Exists in namespace Mono.Data.TdsClient and assembly Mono.Data.TdsClient

  • Used the FreeTDS and jTDS projects as resources.

  • Does not require a client library

  • Requires the assembly Mono.Data.Tds.dll which implements the TDS protocol

  • Uses TDS Protocol Version 4.2 by default



  • Have a working mono and mcs installed

  • Have access to a Sybase or Microsoft SQL Server database or either download it:

  • Microsoft SQL Server

  • Sybase

  • If using Microsoft SQL Server 2000, make sure you are using at least Service Pack 3 for Microsoft SQL Server 2000

  • Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient named SqlTest.cs and you could use this as a basis for your test.

Connection String Format

  • Has a connection string format:
Server=hostname;Database=databaseName;User ID=userid;Password=password
  • The Server part can be used two ways:

  • hostname - “Server=MYHOST”

  • hostname,port - “Server=MYHOST,1533”

C# Example

 using System;
 using System.Data;
 using Mono.Data.TdsClient;
 public class Test
    public static void Main(string[] args)
       string connectionString =
          "Server=localhost;" +
          "Database=pubs;" +
          "User ID=myuserid;" +
       IDbConnection dbcon;
       dbcon = new TdsConnection(connectionString);
       IDbCommand dbcmd = dbcon.CreateCommand();
       string sql =
           "SELECT fname, lname " +
           "FROM employee";
       dbcmd.CommandText = sql;
       IDataReader reader = dbcmd.ExecuteReader();
       while(reader.Read()) {
            string FirstName = (string) reader["fname"];
            string LastName = (string) reader["lname"];
            Console.WriteLine("Name: " +
                 FirstName + " " + LastName);
       // clean up
       reader = null;
       dbcmd = null;
       dbcon = null;
  • Building C# Example:

  • Save the example to a file, such as, TestExample.cs

  • Build using Mono C# compiler:

 mcs TestExample.cs -r:System.Data.dll -r:Mono.Data.TdsClient.dll
  • Running the Example:
 mono TestExample.exe