Access Oracle database from Visual Studio 2008 - c#

I need to be able to access Oracle database from Visual Studio 2008(Framework 3.0/3.5). The Database version is 11g.
But I also may need to access older version of this database going back to the year 2007.
I tired to install Oracle database client 11gR2 on my desktop computer which has Windows 7 Enterprise edition.
It did not run from Setup menu but ran from background it seems.
Did notice a folder in C:/Oracle with 2 files sqlnet.ora and TnsNames.ora, but apart from that I noticed in the c:\windows\assembly there was no Oracle.DataAccess components installed.
Which client or tools should I need to install to be able to access versions of Oracle from Visual Studio 2008?
Assuming you suggest there is a client version for each of the Database versions, Can I install one client version on top of the other.
Now that I have installed the client 11gR2 can you tell me if I need to install it, I do not see an uninstaller under my "All Programs" menu .

First of all you need to install ODAC as mentioned in the comment.
Then in your project you need to reference Oracle.DataAccess and in your code you need to include the following
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;

Related

Trying to use Entity Framework with Oracle DB

Hi I am trying to use Entity-Framework in asp.net MVC , for that I have installed Oracle.Managed.DataAccess version 19.6.0 and Oracle.Managed.DataAccess.EntityFramework version 19.6.0
and oracle version 11.2.0 I am able to connect Oracle DB in server explorer but while adding new item in solution not getting any option to connect Oracle DB what is the issue I am not able to identify ,Any idea would be appreciated.
Image
Those are just the Nuget packages to allow your project to connect to Oracle.
I believe you need to add Oracle Developer Tools for Visual Studio to have the options available in the Visual Studio dialogs.
https://www.oracle.com/database/technologies/developer-tools/visual-studio/
You need to install a Oracle Client and TNSNAMES.ORA
The installation has a component list, if you insall that components (like Oracle developer Tools for visualStudio) it you can add your EF. and then when you finish you only need to add your TNSNAMES in order to create the Entities in VS.

Fresh install on new pc visual studio sql error

I have just installed visual studio on a new windows 8.1 PC. When I try to run a new MVC project I get the following error when registring in the default mvc framework:
"Your sql server installation is either corrupt or has been tampered with (unknown package id)."
This is a brand new install and I have tampered with nothing. I saw it typically has to due with renaming your computer, but since this is a fresh install it shouldn't be an issue.
Please try the below mentioned options.
Change the name of the computer where it was originally might sort
this error.
Update the SQL server to the latest version and verify if it is compatible with installed visual studio.
If above option fails, then re-install SQL Server.
This error occurred because it might have got installed alongside with visual studio. Better install the version that is compatible with your system.
http://blog.sqlauthority.com/2009/05/28/sql-server-fix-error-sqldumper-library-failed-initialization-your-installation-is-either-corrupt-or-has-been-tampered-with-please-uninstall-then-re-run-setup-to-correct-to-correct-this-problem/
Fix/Workaround/Solution:
Go to Add/Remove Program in windows Control Panel
Remove “microsoft SQL server vss writer” program
Reboot the computer.

"Reference package not found. Device Connectivity Component" when delopying C# program to Windows Mobile 6.5 device

I'm working on a C# project for windows mobile 6.5 and as of this morning I'm getting "Reference package not found. Device Connectivity Component" whenever I try to deploy.
It builds without errors and was working up until today. I did a bit of looking around and only found dead ends online. As far as I can see there are no clues about that component or package this is a reference to. I think it may be related to Windows CE SQL Compact but that's based on nothing. I've rolled back to an earlier version of my code and cleaned a few times. I'm stumped.
I would greatly appreciate any help even diagnosing this a bit further. I'm using Visual Studio 2008 3.5 SP1
Update: When I disable "Deploy latest version of the .NET Compact Framework (including Service Packs)" it does deploy but then throws errors related to the SQL database which worked previously. assumedly because it doesn't have access to the correct SQL packages.
Update: I also get the same error with the emulator, it builds, the emulator starts but can't deploy, giving the same error.
Update: I think this might have something to do with it. Note the double slashes in the path. I keep removing them. It keeps coming back.
Update/Correction: I can now deploy to the emulator, I had a problem before but it seems to be ok now. I still can't beploy to the device, same error.
For anyone who was pulling their hair out like me. I couldn't figure out what was wrong although I still suspect it was something to do with the .NET compact package. Eventually I created a new project, set up the references and copied and pasted the code over. It's not a nice solution but it worked after days of being stuck.
HA! I found it! This may not be your solution, but this was how I did it.
See this REF: http://msdn.microsoft.com/en-us/library/aa983326(v=vs.90).aspx
Since Microsoft is bad about deleting their old info, I'm going to post it here, too. But basically, if you select a Private Deployment, then Microsoft Updates will not influence your project or update your 3.5 databases to ...whatever the newest stuff from Microsoft is.
How to: Deploy a SQL Server Compact 3.5 Database with an Application
You have two deployment options for applications that contain SQL Server Compact 3.5 databases. The method of deployment you choose depends on the servicing requirements of your application and whether your users will need administrative credentials on the computer on which the application will be installed.
Following are the deployment options for SQL Server Compact 3.5 databases:
Traditional Microsoft Windows Installer (Microsoft setup technology)
Users need administrative credentials to install the application.
SQL Server Compact 3.5 will be serviced by Microsoft Update.
Can use ClickOnce deployment.
-or-
Private file–based deployment (deploying the SQL Server Compact 3.5 DLLs as part of the project)
Users do not need administrative credentials to install the application.
SQL Server Compact 3.5 will not be serviced by Microsoft Update.
Can also use ClickOnce deployment.
Traditional Windows Installer
Traditional Windows Installer technology is used in both standard Setup and Deployment projects and in ClickOnce deployment. When you deploy a SQL Server Compact 3.5 database, ClickOnce deployment provides an option that automatically installs SQL Server Compact 3.5 if it is not detected on the target computer. For this reason, ClickOnce is the preferred method of deployment for applications that include SQL Server Compact 3.5 databases (as opposed to creating a custom action in a Setup and Deployment project).
ClickOnce deployment has been updated so that it automatically includes the SQL Server Compact 3.5 runtime as a prerequisite for applications that include SQL Server Compact 3.5 databases. It also recognizes .sdf files as data files and sets these to the correct publish status.
Creating a ClickOnce deployment for an application that contains a SQL Server Compact 3.5 database consists of configuring the proper publish information in the Project Designer.
To use Windows Installer technology for ClickOnce deployment of an application that contains a SQL Server Compact 3.5 database
To open the Project Designer, in Solution Explorer/Database Explorer, double-click My Project if you are working on a Visual Basic project (or Properties if you are working on a C# project).
Click the Publish tab.
Click Application Files and set the .sdf file to Data File (Auto). (This setting notifies the installer to treat this as a local data file and to put it in the Data Directory.)
Click Prerequisites and select SQL Server Compact 3.5. (This setting notifies the installer to check whether the SQL Server Compact 3.5 runtime exists and to install it from the Internet if it is not found.)
Creating the Installer After the publish information is configured, create the installer.
To create the installer
In the Publishing Location box, type the Web site, FTP server, or file path to publish the installer to.
Click Publish Now to create the installer.
The application is ready to be installed. Go to the location you published to, and install the application to verify.
Private File-Based Deployment
Private file–based deployment refers to the process of including the required SQL Server Compact 3.5 DLLs as files in the project (as opposed to a reference to DLLs already on the target computer). If you include the necessary DLLs with the application, the requirement to install SQL Server Compact 3.5 is removed. Therefore, the administrative credentials are no longer needed.
You can use ClickOnce deployment technology for private file–based deployment. If you do, you must remember to clear the SQL Server Compact 3.5 prerequisite so that the Setup program does not install it.
To deploy a SQL Server Compact 3.5 database by using private file–based deployment
To open the Project Designer, in Solution Explorer/Database Explorer, double-click My Project if you are working on a Visual Basic project (or Properties if you are working on a C# project).
Click the Publish tab.
Click Prerequisites and then clear the check box for SQL Server Compact 3.5.
Close the Project Designer.
Go to the directory that contains the SQL Server Compact 3.5 DLLs. These are located in C:\Program Files\Microsoft SQL Server Compact Edition\v3.5.
Select the seven SQL Server Compact 3.5 DLLs and copy them:
sqlceca35.dll
sqlcecompact35.dll
sqlceer35EN.dll
sqlceme35.dll
sqlceoledb35.dll
sqlceqp35.dll
sqlcese35.dll
Paste the DLLs into the project in Solution Explorer/Database Explorer.
Select all seven DLLs in Solution Explorer/Database Explorer and open the Properties window.
Set the Copy to Output Directory property to Copy if newer. (This will replace any earlier DLLs in an existing application with the newer ones if the application is updated.)
Click the Show All Files button in Solution Explorer/Database Explorer.
Expand the References node.
Select System.Data.SqlServerCe.
Set the Copy Local property to True. (Because your development computer has the SqlServerCe DLLs in the global assembly cache, you must configure the application to use the DLLs in the output directory.)
Right-click the project in Solution Explorer/Database Explorer and select Publish to open the Publish Wizard.
Complete the wizard to publish the application.
The application is ready to be installed. Go to the location you published to, and install the application to verify.
I had the same problem. I got it to work by closing visual studio, renaming the directory:
C:\Documents and Settings\\Local Settings\Application
Data\Microsoft\CoreCon
Then reopening visual studio and the deploy worked.

Connect to Oracle database 11g with asp.net

I use Microsoft Visual Studio Express 2012 for Web and Oracle database 11g in Window 8.
When I use GridView to connect the database, I get following error.
Oracle Client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation.
Provider is unable to function until these components are installed.
How can I solve this problem?
by installing the oracle drivers http://www.oracle.com/technetwork/database/windows/downloads/index-101290.html
I have found this answer from here, hope it solves your issue:
To find out the reason and solutions for this error follow the
following steps
Try a test connection in oracle's sql plus utility. If the connection fails you have a bad installation or configuration of
oracle client components.
If the oracle is first installed on IIS you should reboot at once.
If theire is multiple copies of OCIW32.dll you have to make sure that there is only one copy of OCIW32.dll which should be in /Bin
folder of the oracle home folder.
Add the IUSR_machine name account and the IWAM_machine name account to the Oracle home folder. Give both accounts full control.
To do this, right-click on the Oracle home folder in Windows Explorer.
Click Properties, and then click the Security tab. Add the appropriate
accounts and then give them full control. Restart your computer.

How to make my project runnable on any system?

I have developed a solution in Visual Studio 2008 C# WPF!
I'm using a service-base SQL database (I've created and managed using Microsoft Visual Studio Sever Explorer), now I'm going to publish it but the problem is that when I install .NET Framework 4.0 and SQLEXPRESS 2005 on other systems, my application doesn't launch! :-(
What componenets should I install on the systems to make it runnable?
If you develop with Visual Studio 2008 you will probably need to install .NET Framework 3.5 with Service Pack 1.
If that is not enough you need to post the error you get. Probably in the eventviewer you will see more info.
You can try to create a setup using Clickonce. To do this you need to go to the property pages of the WPF project an go to the tab Publish.
There you can choose to publish it to the network or to a local directory which can be put on a CD or USB device. The most important thing for you to check is the button "Prerequisites".
I hope this helps!
EDIT to help with the comments:
It is perfectly possible to put the prerequisites in the same folder as the install or even better in a fixed network location as you can see in this screenshot below

Categories