I am trying to connect to Oracle via C# but I am missing a reference to make this work:
using Oracle.DataAccess.Client;
The error is of course:
The type or namespace name 'Oracle' could not be found (are you
missing a using directive or an assembly reference?)
Since this is the standard error for missing a reference.
I am using Oracle 11.2.0.
I tried to find the reference online but I can't manage to find a working one. Also is there anything more I need in C# to connect to an Oracle database?
Where do I find the right reference?
Make sure you have installed the Oracle .Net stuff: ODP.NET.
This will include some .NET wrapper classes to the underlying Oracle client. If memory serves, they should be placed in GAC so should be easy to find from the VS.NET add references window.
Related
I tried to connect my project to a database, using LINQ to SQL, following a few online guides. I created a simple database Library, added new LINQ to SQL Classes item in the project, named SimpleLibraryDatabase, connected to the server and dragged the required tables. So far no problems, but when i tried to build the solution, it failed. Source of the problem appears to be in the auto-generated file SimpleLibraryDatabase.designer.cs, where it gives me over 70 errors, most of them saying:
The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
What is also weird for me, in this generated context class, there is no constructor, that takes 0 arguments, unlike in all the tutorials I've watched.
This is my first time playing with databases in C#.
LINQ to SQL is a component of .NET Framework version 3.5, It's just available on .NET Framework 3.5 ~ 4.8 and not accessible to classes in the .Net core.
LINQ to SQL is a component of .NET Framework version 3.5 that provides a run-time infrastructure for managing relational data as objects.
Microsoft
using MySql.Data.MySqlClient;
Ive followed this guide to install the reference. How do I add a reference to the MySQL connector for .NET?.
When the reference is added, all errors go away, but when I try to run it, I get this error:
"The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference)"
As you can see from the screencap, the reference shows up under 'references'.
Ok Sorted it, If you use framwork 4, like me, you need to use the reference version 6.3.5.0
Thanks
I've been attempting to connect a MySql database to my project in Visual Studio 2015. In order to connect it in the Server Explorer, I had to download and add the reference to my project. Easy peasy.
Then, when I attempted to follow this tutorial, I get this error message:
The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or an assembly reference?)
I have indeed added the assembly reference (I believe, if I understand the term correctly), by checking the MySql.Data in the References/Extension.
Am I using the wrong MySql.Data? How do I know which one? I've read that perhaps it can have to do with mixed versions of .NET Frameworks, but honestly I don't know how to check.
I'm an up-and-coming programmer, who before this, had only worked with static, hard-coded webpages, and never used databases in a project before.
EDIT: I have indeed added the 'using MySql.Data.MySqlClient to the same class file as I am attempting to use it in.
More information. What is displayed when I hover over the Data in MySql.Data.MySqlClient in the 'using' statements.
Your first screenshot shows the quickactions window suggesting that you use a fully qualified name, for the type, because it cannot determine where the type comes from.
Search to make sure that MySql.Data is not used, as a namespace, elsewhere in your project, so that it does not collide with the MySql.Data namespace from the dll you are referencing.
I have a server that Shrepoint installed on it.
I want to test this code:
SPUtility.GetLocalizedString Method
When I add reference to Microsoft.SharePoint.dll I can resolve SPSite and ... .The problem is When I want to build the project it does not recognize using Microsoft.SharePoint any more:
and I get this error:
Error 13 The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
where is the problem? I add reference to Microsoft.SharePoint.dll but in build time it does not works
Microsoft.SharePoint.dll from SharePoint 2010 use Framework 3.5
but
Microsoft.SharePoint.dll from SharePoint 2013 use Framework 4.0
try it.
Change Visual Studio project solution properties platform target to x64 and the target framework to .NET Framework 3.5.
Try to use this namespace:
using Microsoft.SharePoint.Utilities
In the link you gave, it says that the method resides in Namespace Microsoft.SharePoint.Utilities instead of Microsoft.SharePoint. This is just a guess maybe work, haven't tested it,
I want to connect through code c# with wamp mysql but have some problem...
Under MySql of this line
using MySql.Data.MySqlClient;
I have error
Error 1
The type or namespace name 'MySql' could not be found (are you
missing a using directive or an assembly reference?)
I have searched this problem from net but according to that solutions, my microsoft visual 2008 should have mysql.data and web.data in add reference but I don't have these references
If any one have any alternative solution then please help me
thanks
you need to run through the installation of the mysql connector libraries, then add a reference to them in your project. after that, you should be able to add the using statement for MySql.Data.MySqlClient.
You have to add MySQL as a reference.
http://msdn.microsoft.com/en-us/library/7314433t%28v=vs.80%29.aspx
Of course, you'll have to install/download them first.
Make sure that you have the necessary assemblies referenced in your project (in Solution Explorer there is a References section. You can view and add through that).
Also, if you do have the above complete, then you need to have using yourNameSpace;.