# missing c# references to System.Data

**URL:** https://discussions.unity.com/t/missing-c-references-to-system-data/382278
**Category:** C# & .NET
**Tags:** Scripting
**Created:** [June 14, 2008, 11:02am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278 "2008-06-14T11:02:30Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![SixTimesNothing\_1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/sixtimesnothing_1/32/154925_2.png) [@SixTimesNothing\_1](https://discussions.unity.com/u/SixTimesNothing_1)
#### Post date: [June 14, 2008, 11:02am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/1 "2008-06-14T11:02:30Z")

</div>

hi, i’m having a problem getting some C# code to work. it’s telling me that i am missing the necessary reference for System.Data

i opened the unity.app package and can see the System.Data.dll file in there, so I can’t figure out what’s going wrong. unless it’s because i’m using Unity Indie or something…

any ideas?

alternatively, is there another namespace i can use to write code to connect to a MySQL database?

```auto
Assets/Network Assets/Scripts/ServerDatabaseIO.cs(4) error: The type or namespace name `System.Data' could not be found. Are you missing a using directive or an assembly reference?

```

```auto
Assets/Network Assets/Scripts/ServerDatabaseIO.cs(4) error: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing an assembly reference?

```

thanks in advance to anyone who can help me out.

---

<div class="post-metadata">

### Author: ![StarManta](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/starmanta/32/280327_2.png) [@StarManta](https://discussions.unity.com/u/StarManta)
#### Post date: [June 14, 2008, 11:54am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/2 "2008-06-14T11:54:41Z")

</div>

In JS you’d use #import System;. I think the C# equivalent is #using?

```auto
#using System;

```

[edit: #imput? clearly need more sleep.]

---

<div class="post-metadata">

### Author: ![jeremyace](https://avatars.discourse-cdn.com/v4/letter/j/f6c823/32.png) [@jeremyace](https://discussions.unity.com/u/jeremyace)
#### Post date: [June 14, 2008, 12:12pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/3 "2008-06-14T12:12:27Z")

</div>

> [@""](#):
>
> In JS you’d use #imput System;. I think the C# equivalent is #using?
> 
> ```auto
> #using System;
> 
> ```

I think you mean

```auto
@import System;

```

For C# it’s

```auto
using System.Data;

```

At the very top of the file, outside the class definitions.

-Jeremy

---

<div class="post-metadata">

### Author: ![SixTimesNothing\_1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/sixtimesnothing_1/32/154925_2.png) [@SixTimesNothing\_1](https://discussions.unity.com/u/SixTimesNothing_1)
#### Post date: [June 14, 2008, 12:27pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/4 "2008-06-14T12:27:58Z")

</div>

sorry, should have also explained that i had done that. i have included all of these:

```auto
using System;
using System.Data;
using System.Data.SqlClient;

```

at the start of my code, and also tried various combinations thereof.

These are the lines of code that are causing the error. Unity can’t find the System.Data namespace.

---

<div class="post-metadata">

### Author: ![SixTimesNothing\_1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/sixtimesnothing_1/32/154925_2.png) [@SixTimesNothing\_1](https://discussions.unity.com/u/SixTimesNothing_1)
#### Post date: [June 14, 2008, 3:27pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/5 "2008-06-14T15:27:41Z")

</div>

fixed 😄

in case anyone’s interested, i found 2 solutions here: [http://forum.unity3d.com/viewtopic.php?t=8432](http://forum.unity3d.com/viewtopic.php?t=8432)

i just included System.Data.dll in my assets folder and it works now.

---

<div class="post-metadata">

### Author: ![jashan](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/jashan/32/121709_2.png) [@jashan](https://discussions.unity.com/u/jashan)
#### Post date: [June 29, 2008, 7:23pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/6 "2008-06-29T19:23:29Z")

</div>

Hi there,

just a quick note to save anybody doing this potential bad-ass headaches:

Make sure you use System.Data.dll from the Unity distribution. You’ll find this in the path

> [@](#):
>
> /Applications/Unity/Unity.app/Contents/Frameworks/Mono.framework

If you have Mono installed on your machine, you might also find System.Data.dll in an alternative path:

> [@](#):
>
> /Library/Frameworks/Mono.framework/Libraries/mono/2.0

… I just spent quite a few hours spread over a couple of days finding out why Unity frequently crashed after I closed it, and my game server (which uses the database) crashed frequently when I closed it.

That was the reason (using a probably more recent System.Data.dll instead of the one coming with Unity).

So simply don’t do it 😉

Sunny regards,  
Jashan

---

<div class="post-metadata">

### Author: ![SixTimesNothing\_1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/sixtimesnothing_1/32/154925_2.png) [@SixTimesNothing\_1](https://discussions.unity.com/u/SixTimesNothing_1)
#### Post date: [June 29, 2008, 11:27pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/7 "2008-06-29T23:27:34Z")

</div>

that’s a good point.

i took the System.Data.dll file from the Unity package, but the System.Data.SqlClient.dll file came from some random place on the internet which i don’t remember. i haven’t had any problems at all with running it in the Unity editor, though when I build my server file it no longer wants to connect to the MySQL database on localhost. ☹ this means that to test, i have to build the client and connect to a server running inside the Unity editor, which is starting to get kinda annoying.

i’m thinking this is more of a system security problem than a dll related issue though…

---

<div class="post-metadata">

### Author: ![jashan](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/jashan/32/121709_2.png) [@jashan](https://discussions.unity.com/u/jashan)
#### Post date: [June 30, 2008, 7:43am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/8 "2008-06-30T07:43:01Z")

</div>

Do you have any DLLs in your project root folder? I.e. something like

```auto
Project/SomeDll.dll
Project/Assets/SomeDll.dll

```

with my Unity installation, I’ve recently had a problem with that kind of set up that also caused something to work inside the editor, and not work in the standalone build. In my case, removing Project/SomeDll.dll fixed the problem.

---

<div class="post-metadata">

### Author: ![leegod](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@leegod](https://discussions.unity.com/u/leegod)
#### Post date: [September 6, 2014, 4:48am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/9 "2014-09-06T04:48:29Z")

</div>

> [@jashan](#):
>
> Do you have any DLLs in your project root folder? I.e. something like
> 
> ```auto
> Project/SomeDll.dll
> Project/Assets/SomeDll.dll
> 
> ```
> 
> with my Unity installation, I’ve recently had a problem with that kind of set up that also caused something to work inside the editor, and not work in the standalone build. In my case, removing Project/SomeDll.dll fixed the problem.

Hi. So your reply above’s path is for iOS case?  
Then how to solve in windows and android case?

---

<div class="post-metadata">

### Author: ![leegod](https://avatars.discourse-cdn.com/v4/letter/l/dbc845/32.png) [@leegod](https://discussions.unity.com/u/leegod)
#### Post date: [September 6, 2014, 4:49am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/10 "2014-09-06T04:49:05Z")

</div>

> [@SixTimesNothing\_1](#):
>
> fixed 😄
> 
> in case anyone’s interested, i found 2 solutions here: [http://forum.unity3d.com/viewtopic.php?t=8432](http://forum.unity3d.com/viewtopic.php?t=8432)
> 
> i just included System.Data.dll in my assets folder and it works now.

Hi. Your link now says page not found.

I am also stuck this problem and plz let me know the solution.

---

<div class="post-metadata">

### Author: ![SixTimesNothing\_1](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/sixtimesnothing_1/32/154925_2.png) [@SixTimesNothing\_1](https://discussions.unity.com/u/SixTimesNothing_1)
#### Post date: [September 14, 2014, 11:42pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/11 "2014-09-14T23:42:05Z")

</div>

Hi, it’s actually not my link – it looks like the URLs weren’t fully remapped when Unity moved over to the new forum a while ago.

Also, that post is from 6 years ago! Does this issue still exist? I stopped using MySQL in my projects and moved over to SQLite. Not sure what difference that makes.

Did you try including System.Data.dll in your Assets folder as mentioned above?

---

<div class="post-metadata">

### Author: ![k0mbain](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@k0mbain](https://discussions.unity.com/u/k0mbain)
#### Post date: [October 31, 2014, 8:51am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/12 "2014-10-31T08:51:16Z")

</div>

I found the solution for adding System.Data.dll (I’m also using UnityVS):  
You can find the solution by navigating to:

> **[Baa-utiful family](https://www.bing.com?ref=aka&shorturl=connect-redirect)**
>
> Family gatherings wouldn't be the same without the

Copy the ProjectFileHook.cs to Assets\Editor folder and copy System.Data.dll file from  
C:\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\unity\System.Data.dll  
to your Assets folder (not to plugins, but directly to Assets).  
If you want to put your DLL file in another location within Assets folder, you must edit the path in line 56 of ProjectFileHook.cs:  
RemoveFileFromProject(document, @“Assets\System.Data.dll”);  
to the path where your file lies.

---

<div class="post-metadata">

### Author: ![xiaozengxy](https://avatars.discourse-cdn.com/v4/letter/x/d26b3c/32.png) [@xiaozengxy](https://discussions.unity.com/u/xiaozengxy)
#### Post date: [December 7, 2015, 2:13am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/13 "2015-12-07T02:13:53Z")

</div>

你好！我好像也出现了跟你一样的问题，你是怎么解决的啊?能麻烦你帮我一下吗？谢谢！

---

<div class="post-metadata">

### Author: ![walidabazo](https://avatars.discourse-cdn.com/v4/letter/w/ee59a6/32.png) [@walidabazo](https://discussions.unity.com/u/walidabazo)
#### Post date: [October 1, 2017, 4:49pm UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/14 "2017-10-01T16:49:54Z")

</div>

You can show this videos to connect unity 3d and sqlite and solved all dll error compile for different windows 32bit and 64bit

[![](https://europe1.discourse-cdn.com/unity/original/4X/c/8/a/c8aac3becece307d5ca685efd699b9e04f349e19.jpeg "tutorial Unity3d and SQLite database Part 1") ](https://www.youtube.com/watch?v=CtDSQkLdlZg)

---

<div class="post-metadata">

### Author: ![Shiasu-sama](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/shiasu-sama/32/895366_2.png) [@Shiasu-sama](https://discussions.unity.com/u/Shiasu-sama)
#### Post date: [May 31, 2018, 9:26am UTC](https://discussions.unity.com/t/missing-c-references-to-system-data/382278/15 "2018-05-31T09:26:55Z")

</div>

That link says this now:

“The requested page could not be found.”
