Connect to Oracle database 11g with asp.net - c#

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.

Related

ClickOnce application using SQL Server database

I'm trying to learn how to create a simple application using Visual Studio IDE in C#.
I wrote a little application that uses a local SQL Server database for reading and storing data. On my machine, the program seems to work normally, but when trying to install the application on client computer it seems unable to read from the database.
I've tried to include the following prerequisites to the publish properties but it doesn't work:
Microsoft .NET Framework 4.5.2
SQL Server 2012 Express LocalDB
Any ideas about the right way to do it?
Thanks to all.
You need to install SQL Server Express LocalDB (SqlLocalDB.MSI) on the computer you are deploying your ClickOnce application to.
Selecting "SQL Server Express LocalDB" in the Prerequisites window and using "Download prerequisites from the component vendor's web site" should take care of that:
If you do that it should install the LocalDB for you and any database errors are more than likely resulting from connection string errors or leaving Integrated Security enabled.
You need to test on a target computer which does not have "SQL Server Express LocalDB" installed and verify that after the ClickOnce deployment it is installed. This will confirm that the problem is not the missing prerequisites but the database access issues...

A project which specifies SQL Server 2012 as the target platform may experience compatibility issues with Microsoft Azure SQL Database v12

When I try to publish my code first project into Azure, it shows me this warning:
Warning : A project which specifies SQL Server 2012 as the target platform may experience compatibility issues with Microsoft Azure SQL Database v12.
How can I change the target platform?
I've googled it, but what ever I've found was a sql project of data project, etc.
#David Browne's link leads to the answer, quoting directly from his link:
To change a project’s target platform
Right-click your project in Solution Explorer and select Properties. Click the Project Settings tab on the left to access the Project Settings property page.
The Target platform dropdown list in this page contains all the supported SQL Server platforms that a database project can be published to. For this procedure, select SQL Azure.
Of course for this specific warning, you'll want to select:
Microsoft Azure SQL Database V12
I was getting the same problem using SSMS 2012.
The solution was:
Download and install the latest version of SMSS (in my case, 2018).
Restar the pc.
Log in to my localhost server on SMSS.
Select my db and try again to "Deploy db to Ms Azure".
Good luck.

asp.net application not connecting to oracle 11g even after installing oracle instant client for 11g

I have a asp.net mvc application which is using oracle 11g database. In development machine every thing worked fine, but while deploying it in production server asp.net application is not able to connect to the database server. It is always throwing an empty exception.
I wrote also a simple console application to test the db connectivity. It is also not working. Then I realized it is because that the machine doesn't have a oracle client installed. so I installed Oracle instant client for 11g database 32 bit version. After this the console application started working but the web application still could not connect.
I google lot and finally decided to analyse using process monitor. In process monitor I found that the web application (iis) is looking for an oraclient12.dll.
This oraclient12.dll is part of oracle client for 12c database. I can't understand why it is looking for this dll.
After installing oracle database client for 12g, the above issue with oraclient12.dll got fixed. but iis is now not able to locate oraclsce12.dll.
I searched the whole file-system for this file but could not find.
does anyone know what should i install to get oraclsce12.dll.
Thanks,
Sujith
I was facing similar issue, then came to know that for the dll to be installed you should now also install the option «Oracle Advanced Security»,, by choosing custom installation when installing the oracle 12 client. I did the same and my issue got resolved. You can try this and see if your issue gets resolved.
thanks Sudharsan
This is documented as Oracle bug 17379890.
Oracle provides two workarounds:
Workarounds include:
To avoid the issue in the first place, explicitly select "Oracle NET" component during install
After the fact, you can
do another custom install into the same home, and select "Oracle NET"
copying ORACLSCE12.DLL from an existing install into OH\bin also resolves the issue.
However, making a single copy of file ORACLSCE12.DLL is not sufficient because there are more files which are missing. The workaround works only for certain applications. For example for tnsping.exe you still get an error due to missing files.
You have to take the first solution, i.e. explicitly select "Oracle NET" component during install

"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.

Access Oracle database from Visual Studio 2008

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;

Categories