Exception when starting SQL Server 2012 service from .NET code - vb.net

I'm attempting to start a SQL Server instance from the following code:
Dim computer As New ManagedComputer
Dim pmSQL As ServerInstance = computer.ServerInstances("TheInstance")
When I upgraded to SQL Server 2012 this gives the following error:
SQL Server WMI provider is not available on MACHINENAME.
With an Inner Exception of:
Invalid namespace
Do I need to install something additional on my system? Does this make sense that it worked for pre-2012 but not 2012?
Edit:
I'm using the .dlls from c:\program files\microsoft sql server\100\SDK.

It turns out the app was using dlls from a previous version of SQL Server. I updated to the 2012 version and it seems to work well.

Related

Why does the SqlPublish target fail for a SQL Server 2014 database project?

My machine has the current (March 2014) version of SSDT, Visual Studio 2012 Professional, and SQL Server 2014 Developer. I have a SQL Server project (let's call it MyProject.sqlproj) that targets SQL Server 2014. I attempted the following:
MsBuild.exe MyProject.sqlproj
/t:SqlPublish /p:SqlPublishProfilePath=Somewhere.publish.xml
This fails with the following error:
Deploy error Deploy 72002: Internal Error.
The database platform service with type
Microsoft.Data.Tools.Schema.Sql.Sql120DatabaseSchemaProvider is not
valid. You must make sure the service is loaded, or you must provide
the full type name of a valid database platform service.
If I switch this project to target 2012 (and point to a 2012 instance), this same command runs successfully. I had previously asked a potentially related question, and the answer there resolved my problem then, but that's not the issue here -- I'm able to publish this 2014 DACPAC successfully if I use SqlPackage.exe directly.
What's happening, and how can I fix it?
The issue here is that the VisualStudioVersion environment variable isn't set, in which case the .sqlproj file currently defaults to targeting the VS2010 version (which does not support SQL Server 2014). Calling "set VisualStudioVersion=11.0" before running MSBuild will fix the issue.

The 'SQLNCLI' provider is not registered on the local machine, sql server 2012

Working on deploying an application from my development box to a client. On the client when I run my exe, I get the error "The 'SQLNCLI10' Provider is not registered on the local machine.
I'm developing in SQL Server 2012. I have tried installing sqlncli.msi on the target machine with no luck.
Can anyone tell me what package I need to install on the client machine to get my app to work? And if possible provide a URL to said package?
Thanks!
Figured out I needed the 2008 version as opposed to the 2012 version.
http://go.microsoft.com/fwlink/?LinkId=123718&clcid=0x409
Are you perhaps working on a 64 bit machine and used the 32-bit install?
Here's the 64-bit link: http://go.microsoft.com/fwlink/?LinkID=188401&clcid=0x409
Use SQLNCLI11 for connecting to SQLserver 2012
eg:
Provider=SQLNCLI11;Data Source=trv6s177;Integrated Security=SSPI;Initial Catalog=DPVCube_Stage
Downloads
http://go.microsoft.com/fwlink/?LinkID=239649&clcid=0x409
X86 Package (sqlncli.msi)
http://go.microsoft.com/fwlink/?LinkID=239650&clcid=0x409
X64 Package (sqlncli.msi)
Some updates:
SQLNCLI11 works on windows 10 as well, and it can connect SQL 2012 and 2014 (not tested on later SQL versions)
This is the latest version available
At the time of writing, the most updated package can be found here:
https://www.microsoft.com/en-us/download/confirmation.aspx?id=50402
SQL ServerĀ® 2012 Native Client - QFE
From Microsoft:
It is not recommended to use this driver for new development.
The new OLE DB provider is called the Microsoft OLE DB Driver for SQL Server (MSOLEDBSQL)
which will be updated with the most recent server features going forward.
Article:
https://learn.microsoft.com/en-us/sql/relational-databases/native-client/sql-server-native-client?view=sql-server-2017
Download link:
https://learn.microsoft.com/en-us/sql/connect/oledb/oledb-driver-for-sql-server?view=sql-server-2017
Install the sqlncli10 provider on your machine.
The sqlncli10 provider for SQL 2008 R2 can be downloaded from here.
X86 package.
X64 package

How to connect to SqlAzure with Ssmse Error 208

i have a database on SqlAzure and i can use it in my project as well. But i want to control database in ssmse . i have this 208 error. i have connection string and username and a password to sign in but they aren't work.
http://c1207.hizliresim.com/z/2/9554j.jpg -- The Error!
I suspect you are using Management Studio Express from 2008 or 2008 R2.
You may wish to try a newer version (e.g. SQL Server 2012). The file you want is SQLManagementStudio_x64_ENU.exe (assuming 64-bit, else replace x64 with x86).
Use SSMS 2008 R2 SP1, I also faced that same problem and solved after using sp1

SSDT, do I need different dacpacs if I need to deploy the same db to SQL Server 2008 and 2012?

While converting database project to SSDT and upgrading to SQL Server 2012 I need deployment script to work for both SQL Server 2008 and 2012.
I am using sqlpackage.exe /Action:Publish to deploy the latest database bits.
In sqlproj project properties I do see a target platform dropdown with options 2005/2008/2012 sql server. Does it generate a different dacpac if I change this target platform? Do I need to carry two versions of dacpac for each sql server version?
Or will the same dacpac work for any version of sql server?
I know this is 11 months old, but there is an option when you come to deployment specifically for this scenario - AllowIncompatiblePlatform.
//Set Deployment Options
DacDeployOptions dacOptions = new DacDeployOptions();
dacOptions.AllowIncompatiblePlatform = true;
Without setting the option I can deploy a 2008 dac to sql2012, but it will error if I deploy a 2012 dac to sql2008 with:
Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentCompatibilityException:
A project which specifies SQL Server 2012 as the target platform cannot be published to SQL Server 2008.
Setting the option means I do not get this error and can deploy to previous versions (back to 2005 I believe). NB You may also need to set the option TreatVerificationErrorsAsWarnings to true - YMMV.
The short answer is yes - different DACPACs for different SQL Server editions. Bob Beuachemin wrote a useful blog post about DAC Fx3.0 vs. DAC 2.0
From the command line using SqlPackage.exe, use the p:AllowIncompatiblePlatform option. A warning will still be shown but it will continue. This works from a SQL Server 2012 dacpac going to SQL Sever 2008 R2.
SqlPackage.exe /Action:Publish
/SourceFile:"testdb.dacpac"
/TargetDatabaseName:testDb
/p:AllowIncompatiblePlatform=true
/TargetServerName:"testserver"

.mdf is too new (661) my database supports version 655

I am using SQL Server 2008 express and i want to import .mdf and i get this error:
.mdf version is 661, your db supports the version 655
Which version is 661 and how to import it in sql Server 2008.
Install SQL Server 2008 EXPRESS R2. There is a bug in the Web Platform Installer and it still thinks EXPRESS R1 is the latest version.
You will need to apply a service pack. Check Microsoft Update.
Version 661 sounds like the format used by server 2008 R2 so it looks like someone has installed the beta and then attached your DB to it.
See this link for some more details
http://www.sqlskills.com/BLOGS/PAUL/post/SQL-Server-2008-R2-bumps-the-database-version.aspx
Express 2008 - like without any service pack? Try getting your hands on the latest express version (they did not get service packs, but new installers) and install that. Chance we talk about 2008 R2 express, which should run around somewhere as beta?
You have probably selected the instance name on the dialog box that comes when you try to add a connection from the server explorer in VS 2010. Try giving only the server name and it should work.