Could not load file or assembly 'Microsoft.SqlServer.BatchParser - c#

Currently we moved our Web Applications to a new server so now we have a Database and Web + App Server. Before moving everything was working fine.
But now as we have installed SQL Server on the DB Server we are getting errors related to:
Microsoft.SqlServer DLL files.
So basically the code runs a script on the DB server to create a New Database.
First I was getting the Error, related to: Microsoft.SqlServer.ConnectionInfo.dll
So I installed, the nuget Package: Shared Management Objects
Which seemed to have fix the Problem.
BUT now I am getting an error related to Microsoft.SqlServer.BatchParser
I followed the links online and they suggest to install:
Shared Management Objects from here; https://www.microsoft.com/en-pk/download/confirmation.aspx?id=29065
Note; we are using SQL server 2012 standard.
So I installed Shared Management Objects and also restarted the server, but I am still getting the same error.
Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
If I navigate to: C:\Windows\assembly I can see that Microsoft.SqlServer.BatchParser:
The Exception occurs on this line of code:
server.ConnectionContext.ExecuteNonQuery(script);

Related

SQL Server and Visual Studio: how to cope with different Microsoft.SqlServer.Types versions

In Visual Studio (2019) I've made an assembly that is using Microsoft.SqlServer.Types, and I compiled it without error messages.
Now I try to import this assembly into my SQL Server (2019) database with T-SQL, but this message appears:
Msg 10300, Level 16, State 2, Line 1 Assembly "MyAssembly" references assembly 'microsoft.sqlserver.types, version=15.100.0.0,
culture=neutral, publickeytoken=89845dcd8080cc91.', which is not
present in the current database. SQL Server attempted to locate and
automatically load the referenced assembly from the same location
where referring assembly came from, but that operation has failed
(reason: another assembly with same SQL name is already present in the
current database). Please load the referenced assembly into the
current database and retry your request.
In SSMS (18.5.1) I see that the microsoft.sqlserver.types that SQL Server is using has a different version: 15.0.0.0.
If I try to remove this from SQL Server before importing the 15.100.0.0 version I get a message saying that deleting is not possible because it is a system assembly.
What is the best I can do now? I am brand new to this stuff.

How Can I connect to DB2 (version v11.1.0.1527) with Function apps?

I'm trying to connect to DB2 with function apps, but I have problems with DB2 dlls.
I receive this error during the debug of my function app, using latest versions of IBM.Data.DB2.Core nuget packages (1.3.0.100) :
{'Unable to load DLL 'db2app64.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)'}
This line generate the exception:
using (DB2Connection conn = new DB2Connection(str))
The specified dll is present in folder, so someone know what should be the problem?
This could happen if you have the IBM.DataDB2.dll file lying around in directories other than the DB2 client install location. This could have happened without your knowledge where Visual Studio copies the necessary dll into the bin directory of the project.
Same question or the duplicate of IBM.Data.DB2.Core throws exception in azure function app

How to access data from SQL Server database in Win10 UWP

I want to read data from SQL server database in Win10 UWP. So I'm trying to run this sample codes from https://code.msdn.microsoft.com/windowsapps/How-to-access-data-from-935e360c
in Visual Studio to read data from SQL server to UWP. I don't know why I keep getting this error:
Error
I already read this and even tried the answers given :
Type universe cannot resolve assembly: System.Configuration AND Cannot resolve Assembly or Windows Metadata file 'System.Configuration.dll

XMSFactoryFactory.GetInstance(XMSC.CT_WMQ) returns Fatal error: Failed to initialize XMSFactoryFactory

I'm trying to connect to an IBM message queue using .net and MQ client v8.0.0.5 but I keep receiving the following error:
Fatal error. Failed to initialize XMSFactoryFactory
Could not load file or assembly 'IBM.XMS.Client.Impl, Version=8.0.0.5,
Culture=neutral, PublicKeyToken=d2666ab12fca862b' or one of its
dependencies.
The system cannot find the file
specified.":"IBM.XMS.Client.Impl, Version=8.0.0.5, Culture=neutral,
PublicKeyToken=d2666ab12fca862b
Here's what I've done so far:
Installed MQ Client v8.0.0.5 (x64) on my machine.
Referenced the following assemblies:
amqmdnet.dll
amqmdnsp.dll
amqmdxcs.dll
IBM.XMS.dll
IBM.XMS.Admin.dll
IBM.XMS.Client.Impl.dll
IBM.XMS.NLS.dll
IBM.XMS.Provider.dll
IBM.XMS.Util.dll
Now I also have version v7.5.0.4 installed on my machine and that is having no issues connecting to the queue.
One more thing I noticed is there are no assemblies for v8.0.0.5 in the GAC but the assemblies for v7.5.0.4 are present. Can that be the reason?
Unfortunately, I cannot remove v7.5.0.4 until have both the versions working normally.
Yes, MQ v8.0.0.5 XMS .NET assemblies not being in the GAC is most likely the cause.
You can look at the alternative of using redirection, update app.config file to use the correct version of assemblies your application requires. Look into your MQ installation directory for a file called NonPrimaryRedirect.config. This file contains sample configuration required for application to look for a specific version of MQ/XMS .NET assembly. Copy the contents of this file to your application's app.config file and try. You must ensure all href attributes point to correct path.

Could not load file or assembly 'System.Data.DataSetExtensions, Version=3.5.0.0

I have a C# Console Application that uses System.Data.DataSetExtensions that I can run smoothly on the client's server through the command line. The only thing I did was to copy the bin/Release directory contents to a specific directory on the server and run the app through the cmd.
Now, I want to run the same app through an SQL SERVER Job. I've tried both the CmdExec and T-SQL options, the latest using xp_cmdshell. I've also tried running the program without the job, just with the xp_cmdshell on a new query tab.
I always get this error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'System.Data.DataSetExtensions, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The system cannot find the file specified.
Can someone help me to fix this? Why can I run the program through the cmd line and not through Sql Server?
Thx a lot!
Make sure that the database server (where SQL Server was installed) has .NET Framework 3.5 installed.

Categories

Resources