How to deploy SQLServer CE for VSPackage? - sql-server

I like to deploy SQLServer CE privately on my VSPackage application.
I already tried the following information:
Using Entity Framework with an SQL Compact Private Installation
as well as this one:
How to deploy SQL Server Compact Edition 4.0?
But I still get the following exception message:
The specified store provider cannot be found in the configuration, or is not valid
I guess the above methods do not work for me because my VSPackage will appear as a DLL, while the above methods work for an .EXE application.
Any suggestion how can I do it?
Thanks

Most likely, Visual Studio cannot find and load one of SQL Server Compact Edition assemblies. By default, Visual Studio don’t look dependent assembles in a VSPackage folder if VSPackage code have not explicit reference to such assembles. I described several ways to solve this problem here. Hope it help you.

Related

Access data from Microsoft SQL Server into Unity3d

We have spent more than a couple of days on this have gone though almost all available threads online but nothing has worked so far.
We are using Unity Version 2019.2.1 and Visual Studio 2019 Community Edition.
We have already tried the following:
We have tried using Entity Framework model using both ObjectContext and DataContext and in both ways the app.config file and .edmx file are lost when we reload the solution
We have also tried using legacy SqlConnection using System.Data and System.Data.SqlClient namespaces by copying the dlls into the Plugins folder
We have checked and double checked all SQL Server configurations, ports, authentication, etc. and use SQL Server on day-to-day basis for our other projects.
Can someone please point to any working sample / example / video / article on how to access data from Microsoft SQL Server in Unity3d?
Thanks in advance!
Regards,
Swapneel Shah
Check this for Connect to MS SQL database:
https://forum.unity.com/threads/connect-to-ms-sql-database.484855/

Visual Studio ADO.NET missing

I would like to connect my Visual Studio 2013 project (Windows 8.1 app, x86) to an external SQL Server database to get, visualize and set some values. Therefore I found out that I need to use ADO.NET.
Unfortunately the related template in Visual Studio seems to be missing. So I googled that problem and found some solution possibilities (reset visual studio settings and user data, reinstall Visual Studio, run newest version of EFTools,...), but nothing could help me. I tried for hours now...
So what could be the problem here? I have installed VS13 Ultimate from MSDNAA. Why are the templates missing? Is there another easy way to access the external SQL Server database?
Thank you very much!
edit:
It seems to be that a so named "Universal App" doesn't support ADO.NET (for other projects I easily can add an "ADO.Net Entity Data Model". What else can I do to access a SQL Server database? What is the right way in such case?
Most convenient way to implement database access would be with EntityFramework as you figured out already. What marc_s meant is that for your app, you cannot implement it directly in this type of the project.
Implement your Data Access Layer in a separate project of Class Library and expose the data using either WCF or WEB API projects (your services layer) that will make use of he DAL. For both Entity Framework and for services there are numerous tutorials all over the internet. When your services are working (and tested!) you just add a reference to your universal app and call the services from there. That way the database access is isolated from the application and all the vulnarable and time consuming logic stays on the server side.
P.S. Services and DAL does not need to be kept in the same machine as the database, however it's recommended to keep it in the same network.

Error message when adding SQL Server to Visual Studio 2012

I have been following along with David Gassner's ASP.NET tutorial on Lynda.com and had things going pretty well up until he walked me through adding an SQL server in the Server Explorer in Visual Studio 2012. When following his steps, I receive the following error:
Unable to add data connection.
Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
I have found numerous websites that suggest installing 3 additional programs/add-ons, such as this site.
I have installed all 3 recommended (Native Client, CLR Types, and Management Objects) and restarted the program and my computer, but still nothing seems to work. Any ideas on how I can add the database?
Additional detail: When I test the connection before choosing OK, the test is successful. I am quite new to SQL/Database stuff so please explain as simply as you can, or link to a resource that will help me fix this.
#mattcoker solved his own problem with the following solution
Problem has been solved by switching to Visual Studio 2010, works without a hitch. Thanks for the speedy responses.

Visual Studio References: Specific Version setting question

I have a Winform App that we uses internally that I publish through ClickOnce with SQL Express 2005. The app also references a couple of Microsoft.SqlServer dll's. I am trying to figure out how the Specific Version settings work. I have SQL 2008 installed on my machine they have 2005.
If I select Specific Version = false will it care that the users have SQL 2005 or does that depend on the dll.
Specifically, If I do not specify Specific Version does that mean it will just look in the GAC for any version of that dll?
"Specific Version" is only relevant when you compile, it has no effect at runtime. When set to False, the IDE won't complain when the [AssemblyVersion] of the reference assembly has changed. Which is not that great an idea, you ought to be aware of the changes you might have to make in your code because the assembly changed.
The CLR will not look for any version of an assembly in the GAC. Only a exact match is accepted. That's the default policy, you can override it with a <bindingRedirect> in the app's .config file.
Afaik, there isn't a provider for SQL Server that's specific to the SQL Server version number. Not quite sure about that.
Someone at MSFT who's related to the SQLExpress product told me today that it's so hard to figure out if it's installed already, they have a program that does it that's part of the bootstrapper package in Visual Studio. (I was ragging him about how difficult it is to install SQLServer.)
Writing code in a .NET application to connect to and use a SQLServer database is not version-specific, and Microsoft is committed to maintaining backward compatibility.

SQL Server SMO complains of missing DLL

Ok, I've scoured the web, BOL, various forums and I'm no closer to an answer...hopefully you fine folks can lend a hand...
We've got a dozen or so SQL Servers (some 2k, some 2005) on a network. I'm using SMO objects in a .NET application to get some standard information. My problem appears to boil down to a missing DLL - Microsoft.SqlServer.BatchParser.dll. However, this DLL did not come with the other SQL DLLs (Microsoft.SqlServer.ConnectionInfo.dll, Microsoft.SqlServer.Smo.dll, Microsoft.SqlServer.SmoEnum.dll, Microsoft.SqlServer.SqlEnum.dll, etc...). I also downloaded the SS2005 feature pack from Microsoft's site that includes the SMO objects, but still no luck.
The following code works, unless I uncomment the line that is currently commented, in which case I get the error below:
protected void btnArchive_Click(object sender, EventArgs e)
{
ServerConnection conn = new ServerConnection("my_server");
conn.LoginSecure = false;
conn.Login = "my_login";
conn.Password = "my_password";
Server s = new Server(conn);
Database d = s.Databases["my_database"];
//Table tbl = d.Tables["my_table"];
Response.Write(s.Name + " " + s.Information.RootDirectory + " " + d.CreateDate.ToShortDateString());
conn.Disconnect();
}
Error:
Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
Note, I've also tried this from SSIS using VB.NET, same behavior.
Any thoughts would be appreciated.
Thanks.
I was able to successfully run your code using the 10.* versions of the assemblies "Microsoft.SqlServer.ConnectionInfo", "Microsoft.SqlServer.Management.Sdk.Sfc" and "Microsoft.SqlServer.Smo". Try downloading the 2008 version of the SMO components, maybe it was a bug that they've now fixed.
Are you running a x64 OS on your box? There appear to be problems with BatchParser.dll in 64-bit environments - usually it is recommended to download the SMO x64 Package (SQLServer2005_XMO_x64.msi) from Microsoft.
See information about this here.
I know I'm very late to the party here, but this is still the first result when you google "smo batchparser".
When installing SMO 2014 (12.0.x) some DLLs are only installed to the GAC. To make your app work without having to manually install SMO in the target server, you must copy these DLLs with your app. Here are the paths where I got them from.
C:\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll
C:\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll
C:\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.Smo.dll
C:\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.SmoExtended.dll
C:\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll
C:\Windows\assembly\GAC_64\Microsoft.SqlServer.BatchParser\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.BatchParser.dll
C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.BatchParserClient\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.BatchParserClient.dll
C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlClrProvider\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.SqlClrProvider.dll
To access the GAC files you will need to disable the windows built-in viewer using the instructions provided by this article.
An excerpt of the article for convenience:
Open the registry editor and add/set the HKLM\Software\Microsoft\Fusion\DisableCacheViewer DWORD value: 1
You need to install following package to solve the problem , I have solved this problem twice with this package hope it may work for everyone too...
Microsoft SQL Server 2005 Management Objects Collection The Management Objects Collection package includes several key elements of the SQL Server 2005 management API, including Analysis Management Objects (AMO), Replication Management Objects (RMO), and SQL Server Management Objects (SMO). Developers and DBAs can use these components to programmatically manage SQL Server 2005.
You can get from Feature Pack for Microsoft SQL Server 2005 - December 2008 from Microsoft site
http://www.microsoft.com/en-us/download/details.aspx?id=11988
But the link location of download page changes every-time if you don't find resource you can download it from my blog too.
I have also provided some tips and resources about this in my blog if you want http://rndp-android.blogspot.com/p/missing-microsoftsqlservermanagementsdk.html
Just so we understand the issue properly, the Microsoft.SqlServer.BatchParser.dll is not installed in the Global Assembly Cache on your development machine? If so, you might want to start with re-installing the .NET Framework (the version of the Framework that you are targeting) to see if that resolves the issue.
You can also try using the .NET Framework Configuration tool to see if the assembly is indeed present in the Global Assembly Cache (GAC). This MSDN Article describes how to use this tool.
(A search of my hard drive did not return the Microsoft.SqlServer.BatchParser.dll assembly even though I can see it using the .NET Framework Configuration tool).
it comes as part of the 2005 or 2008 upgrade advisor.

Resources