In text:

1. Download “mysql-connector-net-6.2.2-src.zip”  from http://dev.mysql.com/downloads/connector/net/ and extract the zip file.  Note that we need ‘src’ version of library if we want to debug in visual studio.

2. Open your Visual Studio Solution and add  “Mysql.data.csproj”  located at  “MySql.Data\Provider\” inside the extracted archive.

3. Add this project’s reference to your project (mysql.data).

4. Now you can debug into mysql.data methods.

Advertisements

One of my co-workers asked me if I know on top of my head to remove additional white spaces in a sentence using C#.   We all know that Trim() removes white spaces at front and end…. and “Replace” can be used to remove all white spaces in string   BUT  he dont want to remove all spaces …he just wants to remove extra spaces if any….

Input :  This is              a test sentence   with    some                 spaces
Desired Output :   This is a test sentence with some spaces

Using RegEx here is the way, if you need it…. 

System.Text.RegularExpressions.Regex.Replace(input, @”\s+”, ” “);

Remember that this removes all whitespace characters including tabs, newlines  etc…  which is he wants anyway!