1 * Microsoft SQL Server Provider
4 <li>ADO.NET Provider for Microsoft SQL Server 7/2000 databases</li>
6 <li>Exists in namespace System.Data.SqlClient and assembly System.Data</li>
8 <li>Created by Tim Coleman</li>
10 <li>Used the <a href="http://www.freetds.org/">FreeTDS</a> and
11 <a href="http://jtds.sourceforge.net/">jTDS</a> projects as resources.</li>
13 <li>Implemented in 100% C#</li>
15 <li>Is similar to the Mono.Data.TdsClient and Mono.Data.SybaseClient providers.</li>
17 <li>Requires the assembly Mono.Data.Tds.dll which implements the TDS protocol in 100% C#.</li>
19 <li>Uses TDS Protocol Version 7.0</li>
21 <li>Bugs with Mono or the data provider should be reported
22 in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
23 do not have Bugzilla user account, it is free
25 create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
34 <li>Able to connect to Microsoft SQL Server 7/2000 databases</li>
36 <li>Connection pooling works.</li>
38 <li>Stored Procedures work</li>
40 <li>Parameters work.</li>
42 <li>Prepare works.</li>
44 <li>SQL commands can be executed
45 via ExecuteNonQuery() of a SqlCommand.</li>
47 <li>SQL aggregates can be executed and a single row and single column
48 result can be retrieved via ExecuteScalar() of a SqlCommand</li>
50 <li>SQL queries can be executed via ExecuteReader() and results
51 can be retrieved via SqlDataReader.</li>
53 <li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
54 in a SqlDataReader</li>
56 <li>XML can be read via ExecuteXmlReader in a SqlCommand.</li>
58 <li>Data can be filled in a DataTable in a DataSet via a SqlDataAdapter</li>
60 <li>Uses TDS Protocol Version 7.0</li>
62 <li><a href="http://www.go-mono.com/tds-providers.html">Design of the Microsoft SQL Server, Sybase, and TDS Providers in Mono</a></li>
64 <li>Works in the SQL# command-line and GTK# GUI version</li>
70 <li>Connection timeouts is being developed now</li>
72 <li>Needs more testing</li>
74 <li>Would like to figure out how to connect via Trusted_Connection or Integrated Security</li>
76 <li>Start work on TDS Protocol Version 8.0 support</li>
83 <li>Have a working mono and mcs installed</li>
85 <li>Have access to a Microsoft SQL Server database
86 or either download it:
88 <li><a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a></li>
92 <li>If using Microsoft SQL Server 2000, make sure
93 you are using at least Service Pack 3 for Microsoft SQL Server 2000. If using
94 MSDE 2000, make sure you have the special Service Pack 3 for MSDE 2000.</li>
96 <li>For those that only have MSDE installed. You can change the authentication mode
\r
97 from Windows Only Authentication to SQL Server and Windows Authentications (also knows as Mixed-mode authentication)
\r
98 via the <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322336&sd=tech#4">registry</a></li>. It is
\r
99 the LoginMode you need to change. By default,
\r
100 MSDE is installed with Windows Only Authentication. For SqlClient to work with MSDE, you will
\r
101 need to change the setting.</a>
\r
103 <li>If using MSDE, you might need to create a new user with password. Give
\r
104 this user access to various databases in this MSDE instance. Also, for each
\r
105 database, give this new user at least SELECT access to the various tables you want
\r
106 to retrieve data from.</li>
\r
108 <li>If you have Enterprise Manager, you can easily change the authentication mode
\r
109 for both MSDE and Microsoft SQL Server. To change the authentication mode in
\r
110 Enterprise Mananger, select the instance, right-click on it, and select properites.
\r
111 The SQL Server properties dialog for that instance will pop up. Choose the Security
\r
112 tab. Change the authentication from Windows Only to SQL Server and Windows. If
\r
113 the instance of your database does not show up in Enterprise Manager, Register first
\r
114 by selecting the Action menu and choosing New SQL Server Registration.</li>
\r
116 <li>Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient
117 named SqlTest.cs and you could use this as a basis for your test.</li>
119 <li>Mono's SqlClient does not support trusted connections
120 nor integrated security. You can not use this when connecting. You need
121 to explicitly use a User ID and Password
122 authenticated by SQL Server.</li>
124 <li>Has a connection string format:
126 Server=hostname;Database=databaseName;User ID=userid;Password=password
129 <li>The Server part can be used three ways:
133 <td><b>Server Definition</b></td> <td><b>Example</b></td>
137 <td>hostname</td> <td>Server=MYHOST</td>
141 <td>hostname,port</td> <td>Server=MYHOST,1433</td>
145 <td>hostname\\instance</td> <td>Server=MYHOST\\NETSDK</td>
154 using System.Data.SqlClient;
158 public static void Main(string[] args)
160 string connectionString =
161 "Server=localhost;" +
163 "User ID=myuserid;" +
164 "Password=mypassword;";
166 dbcon = new SqlConnection(connectionString);
168 IDbCommand dbcmd = dbcon.CreateCommand();
170 "SELECT fname, lname " +
172 dbcmd.CommandText = sql;
173 IDataReader reader = dbcmd.ExecuteReader();
174 while(reader.Read()) {
175 string FirstName = (string) reader["fname"];
176 string LastName = (string) reader["lname"];
177 Console.WriteLine("Name: " +
178 FirstName + " " + LastName);
191 <li>Building C# Example:
193 <li>Save the example to a file, such as, TestExample.cs</li>
196 mcs TestExample.cs -r System.Data.dll
199 <li>Build on Windows via Cygwin:
201 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
202 TestExample.cs -r System.Data.dll
207 <li>Running the Example: