- Home /
Missing Namespaces
Hi there, I was trying to establish a connection to a Mysql Server using this code, and as far as i know, i need this:
using System;
using System.Data;
using MySql.Data.MySqlClient;
[...]
Here comes the problem: when I finished the script (just connecting to the DB) and I went to the Unity editor, i got this errors:
Assets/Standard Assets/Scripts/SQL/Connection.cs(3,7): error CS0246: The type or namespace name `MySql' could not be found. Are you missing a using directive or an assembly reference?
-------------------
Assets/Standard Assets/Scripts/SQL/Connection.cs(2,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?
I've been looking the whole day for a solution on the internet and the Unity forums, but I can't solve this problem. I've read something about some dlls in this folder:
/Applications/Unity/Unity.app/Contents/Frameworks/...
But I can´t locate it on my PC, and I'm sure that would fix the problem.
Help is appreciated.
Thank you very much for your time
Well, you should make sure. http://dev.mysql.com/downloads/connector/net/6.1.html#downloads And those are need to be added as a reference to the project too.
ok, the $$anonymous$$YSQL error is fixed, now i have to correct the system.data one
Answer by iviaguic · Sep 23, 2013 at 03:45 PM
OK, it's solved...
Go to edit>project settings>player and set API to .NET 2.0 instead of .NET 2.0Subset
this didn't work i changed my api to .NET 2.0 I am using mysql-connector-net-1.0.10.exe my code begins like this: using UnityEngine; using System.Collections; using UnityEngine.Scene$$anonymous$$anagement; using $$anonymous$$ySql.Data.Types; using $$anonymous$$ysql.Data.$$anonymous$$ysqlClient; using $$anonymous$$ysql.Data.dll; Please help
You can never "use" an EXE directly. It's most likely an installer which will extract the actual DLL(s) you need somewhere. You have to copy those DLLs into your assets folder in order to use the connector.
Answer by Seizure · Sep 23, 2013 at 01:52 PM
Make sure you go to Edit -> Project Settings -> Editor and in the WWW Security Emulation put the URL to your server (IP address or link that you use to access the server).
Nope, thats not my problem. $$anonymous$$y problem has to do with DLLs. Read posts before replying please!
Your answer
Follow this Question
Related Questions
How to fix losing System.Data.dll in Project? 2 Answers
Why does Boo not see namespaces from dlls? 1 Answer
Using C# .dll that doesn't use namespaces 0 Answers
'The type or namespace name could not be found' 1 Answer
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers