OLE DB access from Visual Studio 2019 error - winforms

I try to access an OLE database in order to use it in a Windows Forms .NET Core Application in Visual Studio 2019 and I obtain the next error:
System.Data.OleDb is not supported on this platform.

As the error says a winforms program targeting .NET 5 , OLE DB 7.0.0 cannot run on that version of .NET .
The solution is: the same program target .Net 6.0 works perfectly in VS2022.

Related

SQL Server Management Studio 2012 .NET Framework 4.0 running stored procedure SSIS package targeting .NET 4.5

How do I change the .NET framework of MS SQL Server 2012?
I have a SSIS package that has a script that cannot target .NET 4.0 due to using WebUtility.UrlEncode().
Will upgrading to 4.5 on the Server interfere with other stored procedures that are currently running (and targeting 4.0)?
I tried setting the target of the Script Task to 4.0 but WebUtility.UrlEncode isnt available for 4.0.
Two things at play here.
The first is the target setting for the SSIS Script Task/Component. You can change that up/down as the item requires.
That's a development setting by the way. When you deploy to the server, would need to ensure that server itself has an equivalent runtime on it.
Now, things get "weird" because for the 4.0 runtime framework, which we both have, there are developer versions within that version, from a Command Prompt if you typed
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe you'd see what version there. For example, I see
Microsoft (R) Visual C# Compiler version 4.8.4084.0 for C# 5
How do I find the .NET version?

SSIS connectivity to attunity

I am getting this error in SSIS
****Exception from HRESULT: 0xC0202040
Error at <Task name> [OLE DB Destination [81]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "OraOLEDB" Hresult: 0x80040E21 Description: "Multiple-step
OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".****Error at Populate datacombined data [OLE DB Destination [81]]: Failed to open a fastload rowset for <Table name>.
Check that the object exists in the database.
Please can anyone tell me if the installed versions of software are correct for the below mentioned version of visual studio and Sql server which is installed on my machine:
I am using 64bit- windows 8.1 enterprise.
Sql server : Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) Jun 28 2012 08:36:30 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)
Microsoft visual studio : Microsoft visual studio 2012 shell version 11.0.50727.1
32-bit Oracle Data Access Components (ODAC) with Oracle Developer Tools for Visual Studiobase.
ODTwtihODAC : ODTwithODAC1120320_32bit
64-bit Oracle Data Access Components (ODAC)
ODAC121010_x64
Attunity : I installed attunity version 1.2 -- 32 and 64 bit.
I am able to connect to the oracle DB and able to fetch the data, but the problem is in data access mode of the destination oracle server. It's throwing the error when I set the data access mode as table or view - fast load.
Can anyone please help to resolve this issue. Is there any setting which I need to change in visual studio after installing attunity?
Please note that this is an already existing package and I am trying to open and run it. This package does not throw any error in another machine with data access mode as fast load.
Thanks in advance.
I think this is what you really need to use the correct version of the driver.
In order to force VS to use 32 or 64 libs go to Project Properties->Configuration Properties->Debugging and change Run64BitRuntime.
I don't think that is the correct version of the Attunity Connector. For connecting to MSSQL 2008, we are using 2.0, 3.0 and 4.0 all installed together. I would read the version descriptions that you can get to from here: https://learn.microsoft.com/en-us/sql/integration-services/attunity-connectors?view=sql-server-2017

Visual Studio 2013 Build Error: Incompatible versions of SQL Server Data Tools and database runtime components are installed on this computer

I have Visual Studio 2012 and Visual Studio 2013 installed on my development machine. My SQL projects were created with VS2013 and they compile fine from Visual Studio, but they fail with the following message when I use MSBuild from the command line:
Build Error: Incompatible versions of SQL Server Data Tools and
database runtime components are installed on this computer.
Note: This same error was encountered by other developers in Visual Studio 2012. See This SO question. I have verified that my versions of SSDT are up to date. I am not dealing with the same problem.
To resolve this issue you have to make sure you are using MSBuild 12.0 which comes with Visual Studio 2013 not MSBuild 4.0 which ships with the .Net 4.0 framework.
Make sure your path does not include the .Net 4.0 framework and then add MSBuild 12.0 to your path like this:
SET PATH=%PATH%;"%ProgramFiles(x86)%\MSBuild\12.0\Bin"
Another solution is to set the VisualStudioVersion property to 12.0 like this
MSBuild.exe My.sqlproj /p:VisualStudioVersion=12.0
Note: This same error message has appeared in many different versions of SSDT. This fix is specific to Visual Studio 2013

Is it possible to to add .NET Framework v.2.0 Assembly to SQL Server 2012?

I have a DLL which uses .NET Framework v2.0. and I want to add it to SQL Server 2012 using CREATE ASSEMBLY. But SQL Server 2012 uses .NET Framework v.4.0.
Is it possible to add a .NET Framework v2.0 assembly to SQL Server 2012?
Well, it depends. The question title and question text imply two different questions.
If the question is about a .NET Framework DLL:
No. SQL Server 2012 and 2014 are statically linked to only CLR version 4.0 (meaning .NET Framework versions starting at 4.0 through at least 4.5.2 if not also 4.6 if that has been released). Hence it is not possible to load any Framework DLL that is part of CLR 2.0 (i.e. Framework versions 2.0, 3.0, and 3.5) into SQL Server 2012 or 2014.
However, everything should be backwards compatible and should work just the same if you try to load the CLR 4.0 (i.e. Framework versions 4.0, 4.5, 4.5.1, etc) version of the same Framework DLL. The only reason why this wouldn't work is if the DLL in question, or one of its dependencies, changed to become a mixed-mode DLL in one of the Framework updates that was released after the version that you have been using. The problem in that case would be that SQL Server only supports pure MSIL DLLs.
If the question is about a DLL that you created:
Again, as long as it is not a mixed-mode DLL, everything should be backwards compatible and should work just the same.
If loading the DLL errors with:
Assembly "{AssemblyName}" was built using version vX.Y.ZZZZ of the .NET Framework. SQL Server currently uses version v4.0.30319
then you can probably re-link it to 4.0. Please see my answer to "Cannot register stdole assembly in SQL Server 2012" for an example of doing this.
FYI, I wrote an article that explains the CLR / Framework versions issue in detail: Stairway to SQLCLR Level 5: Development (Using .NET within SQL Server) (free registration required).

connecting to access database using MFC CDatabase in VS2012 and windows 8 x64

To connect a access database by Programming with MFC, using visual studio 2012 update 1 installed on windows 8 x64, the following code throws exception, which did not happened before in vs2010 and windows 7 x64. Is there any thing changed about the ODBC manager and how should I change the connection string.
CDatabase db;
db.OpenEx(TEXT("ODBC;Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dsn='';Dbq='d:\\databases\\a.mdb'");
and the exception message:
'Data source name not found and no default driver specified'
It does not work for accdb file too.
cha in the comments was correct since by default only x64 ODBC driver is present in windows 8 for MFC applications compiling in win32 platform It is necessary to install ODBC driver in x86. It could be downloaded from here: http://www.microsoft.com/en-us/download/details.aspx?id=13255

Resources