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>
35 <li>Connect to Microsoft SQL Server 7/2000 databases via SQL Server authentication and NT Authentication.</li>
37 <li>Connection pooling works.</li>
39 <li>Stored Procedures work.</li>
41 <li>Parameters work.</li>
43 <li>Prepare works.</li>
45 <li>SQL commands can be executed
46 via ExecuteNonQuery() of a SqlCommand.</li>
48 <li>SQL aggregates can be executed and a single row and single column
49 result can be retrieved via ExecuteScalar() of a SqlCommand</li>
51 <li>SQL queries can be executed via ExecuteReader() and results
52 can be retrieved via SqlDataReader.</li>
54 <li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
55 in a SqlDataReader</li>
57 <li>XML can be read via ExecuteXmlReader in a SqlCommand.</li>
59 <li>Data can be filled in a DataTable in a DataSet via a SqlDataAdapter</li>
61 <li>Works in the SQL# command-line and GTK# GUI version</li>
68 <li>Needs more testing and fixing bugs</li>
70 <li>Start work on TDS Protocol Version 8.0 support</li>
72 <li>Add support for the .NET Framework 2.0 (Whidbey)</li>
74 <li>Add support for Microsoft SQL Server 2005 (Yukon) support</li>
81 <li>Have a working mono and mcs installed</li>
83 <li>Have access to a Microsoft SQL Server database
84 or either download it:
86 <li><a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a></li>
90 <li><b>IMPORTANT:</b> If using Microsoft SQL Server 2000, make sure
91 you are using at least Service Pack 3 for Microsoft SQL Server 2000. If using
92 MSDE 2000, make sure you have the special Service Pack 3 for MSDE 2000. You
93 can get it from <a href="http://www.microsoft.com/sql/downloads/2000/sp3.asp">here</a></li>
95 <li>For those that only have MSDE installed. You can change the authentication mode
\r
96 from Windows Only Authentication to SQL Server and Windows Authentications (also knows as Mixed-mode authentication)
\r
97 via the <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322336&sd=tech#4">registry</a></li>. It is
\r
98 the LoginMode you need to change. By default,
\r
99 MSDE is installed with Windows Only Authentication. If you want SqlClient to work with MSDE via SQL Server authentication, you will
\r
100 need to change the setting. Otherwise, you wil have to use NT Authentication.</a>
\r
102 <li>If using MSDE, you might need to create a new user with password. Give
\r
103 this user access to various databases in this MSDE instance. Also, for each
\r
104 database, give this new user at least SELECT access to the various tables you want
\r
105 to retrieve data from.</li>
\r
107 <li>If you have Enterprise Manager, you can easily change the authentication mode
\r
108 for both MSDE and Microsoft SQL Server. To change the authentication mode in
\r
109 Enterprise Mananger, select the instance, right-click on it, and select properites.
\r
110 The SQL Server properties dialog for that instance will pop up. Choose the Security
\r
111 tab. Change the Authentication from Windows Only to SQL Server and Windows. If
\r
112 the instance of your database does not show up in Enterprise Manager, Register first
\r
113 by selecting the Action menu and choosing New SQL Server Registration.</li>
\r
115 <li>Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient
116 named SqlTest.cs and you could use this as a basis for your test.</li>
118 <li>If you want to use Integrated Security (aka NT Authentication aka Trusted Connection aka Domain Login), you
119 will need to specify the Domain User ID and Password. This is because Mono is not integrated with Windows
122 <li>Has a connection string format for SQL Server Authentication:
125 Database=databaseName;
126 User ID=sqlServerUserid;
127 Password=sqlServerPassword
130 <li>Has a connection string format for NT Authentication:
133 Database=databaseName;
134 User ID=windowsDomain\windowsUserid;
135 Password=windowsPassword;
136 Integrated Security=SSPI
140 <li>The Server part can be used three ways:
144 <td><b>Server Definition</b></td> <td><b>Example</b></td>
148 <td>hostname</td> <td>Server=MYHOST</td>
152 <td>hostname,port</td> <td>Server=MYHOST,1433</td>
156 <td>hostname\instance</td> <td>Server=MYHOST\NETSDK</td>
161 <li>C# Example using SQL Server Authentication:
165 using System.Data.SqlClient;
169 public static void Main(string[] args)
171 string connectionString =
174 "User ID=MySqlServerUserId;" +
175 "Password=MySqlServerPassword;";
177 dbcon = new SqlConnection(connectionString);
179 IDbCommand dbcmd = dbcon.CreateCommand();
181 "SELECT fname, lname " +
183 dbcmd.CommandText = sql;
184 IDataReader reader = dbcmd.ExecuteReader();
185 while(reader.Read()) {
186 string FirstName = (string) reader["fname"];
187 string LastName = (string) reader["lname"];
188 Console.WriteLine("Name: " +
189 FirstName + " " + LastName);
203 <li>C# Example using NT Authentication (Integrated Security)
207 using System.Data.SqlClient;
211 public static void Main(string[] args)
213 string connectionString =
216 "User ID=MyWindowsDomain\\MyWindowsUserid;" +
217 "Password=MyWindowsPassword;" +
218 "Integrated Security=SSPI";
220 dbcon = new SqlConnection(connectionString);
222 IDbCommand dbcmd = dbcon.CreateCommand();
224 "SELECT fname, lname " +
226 dbcmd.CommandText = sql;
227 IDataReader reader = dbcmd.ExecuteReader();
228 while(reader.Read()) {
229 string FirstName = (string) reader["fname"];
230 string LastName = (string) reader["lname"];
231 Console.WriteLine("Name: " +
232 FirstName + " " + LastName);
246 <li>Building C# Example:
248 <li>Save the example to a file, such as, TestExample.cs</li>
251 mcs TestExample.cs -r System.Data.dll
256 <li>Running the Example: