unity sql and system.data.dll


im new to unity, and im trying to connect unity the my sql server which on my computer.

im using vs2010 c#. normally in an aplication or asp.net website i can use:
system.data to create SqlConnection object and then comunicate with the sql server with Sqlcommand.

in unity u dont have access to system.data, so i open my unity project with vs2010, and added a refrence to system.data (which i found somewhere on my computer, and im guessing its not helping…) also i copied the file to the unity project.

now the moment i try to initiate this object i get an error
SqlConnection sConn = new Sqlconnection (connectionstring);

and im getting though unity compiler:
Could not load type ‘System.Data.SqlClient.SqlConnection’ from assembly ‘System.Data’.

how do i fix this, all i want is to comunicate with the sql server

anyhelp would be greatly appreciated!


The reason why System.Data is not working is it is not in Unity. Unity uses a subset of Mono’s library, and I do not believe that this subset includes System.Data.SqlConnection. A listing of Mono classes available in Unity is available here: http://unity3d.com/support/documentation/ScriptReference/MonoCompatibility.html