Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I'm getting "The type or namespace name 'SqliteConnection' could not be found (are you missing a using directive or an assembly reference?)" on this line of code:

C#
using (SqliteConnection con = new SqliteConnection(HHSUtils.GetDBConnectionStrSite(paddedSiteNum))


...even though I have System.Data.SQLite in my project's References, and I've got:

C#
using System.Data.SQLite;
using System.Data.SQLite.Generic;


...in the source.

What gives? This is a Windows CE project in Visual Studio 2008.
Posted
Comments
[no name] 30-Oct-14 19:54pm    
Maybe before you completely overheat, try to right klick the error message and click something like "resolve bla bla"

If it does not help...it seems to be your Problem....

Your words: "Why is my SqliteConnection not found when I DO have the assembly reference AND the using clause?

*lol* is it really "your" SqliteConnection...seems not...better not shout to your developing environement and also not here. Otherwhise you get lost in the deep of your references :P
B. Clay Shannon 30-Oct-14 19:56pm    
Yeah, I should have mentioned that I right-clicked "SqliteConnection" and there was no "Resolve" available.
[no name] 30-Oct-14 20:05pm    
Thanks to take my "aggressive" comment that easy. Is it maybe CE env. which is not supporting your request?
Sergey Alexandrovich Kryukov 30-Oct-14 21:48pm    
This is just case-sensitive thing; please see my answer.
—SA
PIEBALDconsult 30-Oct-14 20:19pm    
Improper casing of the QL in SQLiteConnection
http://www.ivankristianto.com/howto-use-sqlite-ado-net-with-c/
A benefit I get by _not_ using using directives.
And I have to say. they shouldn't have their classes in the System namespace.

1 solution

This is just because C# is case-sensitive, and correct name of the type is SQLiteConnection:
http://www.devart.com/dotconnect/sqlite/docs/Devart.Data.SQLite~Devart.Data.SQLite.SQLiteConnection.html[^].

By the way, the use of "using" clause is optional and does not really relate to the use of some assembly, which is defined by referencing it. It's just about the way you can name assembly-level types, no matter in what assembly; it equally apply to the same assembly, for example. The "using" clause just happens to shorten some names in use.

[EDIT]

Actually, all credit should go to PIEBALDconsult, who wrote nearly the same in his comment to the question; I just noticed that only after I already posted this answer.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900