Error while connecting to Database Server from SQL Server Management Studio - sql-server

Recently, while trying to connect to any SQL Server Database from SQL Server Management Studio, I am getting an error - Service 'Microsoft.SqlServer.Management.IRegistrationService' not found (Microsoft.SqlServer.Management.SDK.SqlStudio)
I tried updating to the latest version of SQL Server Management Studio but there is no change.
The full error stack is as below:
===================================
Service 'Microsoft.SqlServer.Management.IRegistrationService' not found (Microsoft.SqlServer.Management.SDK.SqlStudio)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.ServiceProvider.GetService[T](IServiceProvider serviceProvider, Boolean throwIfNotFound)
at Microsoft.SqlServer.Management.SqlStudio.Explorer.NavigationService.Initialize()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.NavigationService.GetView(String urnPath)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.<GetColumnsFromNavigationService>d__11.MoveNext()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.AddFields(List`1 list, IEnumerable`1 fields, IDictionary`2 allValidFields, AddFieldsFlags flags)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.GetParentFields(INodeInformation source, Dictionary`2& allValidColumns)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.BuildDynamicItemWithQuery(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, String urnQuery, Boolean registerBuilder, Boolean registerBuiltItems)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.BuildDynamicItem(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.Build(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.RequestChildren(IGetChildrenRequest request)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ExplorerHierarchyNode.BuildChildren(WaitHandle quitEvent)
Any idea why this error is happening?

What helped in my case... (version 17.9.1)
I have checked file:
C:\Users\<user>\AppData\Roaming\Microsoft\AppEnv\14.0\ActivityLog.xml
In there I have found the information that the directory:
C:\Users\<user>\Documents\SQL Server Management Studio
has not been found.
I have created it manually and... SSMS started working.
Yeah I know... It sounds crazy.

#Marek Malczewski is right, thank you sir!
I too looked at the log files and fixed it the same way, here is a screenshot for your confirmation.

Install .NET 4.8.
I've had exactly the same issue and it worked for me.

Go to C:\Users\ <\users>\Documents
and create a new folder with name SQL Server Management Studio then Restart MSQL server as well.
Hopefully your issue resolved.

Related

SSMS error Microsoft.SqlServer.Management.SqlStudio...package did not load correctly, Microsoft.SqlServer.Management.IRegistrationService not found

I ran into a strange issue when I install SSMS v18.10 on my new work laptop (Win10 Pro Build 19042) with local Admin rights. I have tried both v18.10 and v18.9, uninstalled Extensions, etc. But none of them works. Can you please help? Thanks a lot.
The installation seems all good. But when launching SSMS, it prompts a warning message "The 'Microsoft.SqlServer.Management.SqlStudio.... package did not load correctly".
screenshot1
After ignored this warning, when connection to our Azure SQL Database, it then prompts an error "Service 'Microsoft.SqlServer.Management.IRegistrationService' not found (Microsoft.SqlServer.Management.SDK.SqlStudio)"
screenshot2
I also noticed under "Help" menu, there're two "About" items., one is "About SQL Server Management Studio", and the other is "About...". On my old work laptop, I only got one "About..." in my SSMS. When clicking "About...", I got the same warning message as when launching SSMS.
screenshot3
When click ""About SQL Server Management Studio", I got below information.
screenshot4
Perhaps you can try repairing SSMS via Apps & features (access by clicking windows button and typing app). When open, look for 'Microsoft SQL Server Management Studio - 18.10". Select Uninstall. It should give option for repairing.
I encountered this and found a strange solution. When checking the activity log (C:\Users\[username]\appdata\Roaming\Microsoft\AppEnv\15.0\ActivityLog.xml) I found the following:
<entry>
<record>61</record>
<time>2022/08/10 03:18:52.795</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [Microsoft.SqlServer.Management.SqlStudio, Microsoft.SqlServer.Management.SqlStudio, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91]Source: &apos;mscorlib&apos; Description: Could not find file &apos;C:\Users\[username]\Documents\SQL Server Management Studio&apos;.
System.IO.FileNotFoundException: Could not find file &apos;C:\Users\[username]\Documents\SQL Server Management Studio&apos;.
File name: &apos;C:\Users\[username]\Documents\SQL Server Management Studio&apos;
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at System.IO.Directory.CreateDirectory(String path)
at Microsoft.SqlServer.Management.SqlStudio.SetDefaultProjectOpenLocation()
at Microsoft.SqlServer.Management.SqlStudio.SetupInitialShellSettings()
at Microsoft.SqlServer.Management.SqlStudio.Initialize()
at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)</description>
<guid>{04401FF3-8B0F-4D2D-85EB-2A3542867A8B}</guid>
<hr>80070002</hr>
<errorinfo></errorinfo>
And so, I created the following folder - C:\Users\[username]\Documents\SQL Server Management Studio - and that fixed the problem. ¯\_(ツ)_/¯

Error when importing snapshot to SQL Server 2019

There is an Error when I want to import data from a snapshot(bacpac) file into SQL Server 2019.
It has occur twice on my two different PC.
Please help me if there is any solution about that.
Thank you very much!
Error :
Error Details :
Here are the error details:
===================================
Object reference not set to an instance of an object. (Microsoft.Data.Tools.Schema.Sql)
Program Location:
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateFragment(Int32 operation, IModelElement element)
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateSteps(Int32 operation, IModelElement element)
at Microsoft.Data.Tools.Schema.Sql.Deployment.OrderedStepGenerator.Add(DeploymentScriptDomGenerator scriptDom, IModelElement element, Int32 operation)
at Microsoft.Data.Tools.Schema.Sql.Deployment.Analyzers.PlanMediator.BuildDependencyOrderedSteps(Int32 operation, List1 classOrder, List1 operationOrder, Dictionary2 changes, Boolean preserveGraphs, Dictionary2& relating, Dictionary2& related)
at Microsoft.Data.Tools.Schema.Sql.Deployment.Analyzers.PlanMediator.BuildOperations()
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.OnGeneratePlan()
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.GeneratePlan(List1 drops)
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.BuildPlan()
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.Controller.CreatePlan()
at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass3.<>c__DisplayClass5.b__1()
at Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action)
at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass3.b__0(Object operation, CancellationToken token)
at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context)
at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken)
at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action3 reportPlanOperation, Boolean executePlan)
at Microsoft.SqlServer.Dac.DacServices.ImportBacpac(BacPackage package, String targetDatabaseName, DacImportOptions importOptions, Nullable1 cancellationToken)
at Microsoft.SqlServer.Dac.DacServices.ImportBacpac(BacPackage package, String targetDatabaseName, DacAzureDatabaseSpecification creationDefaults, Nullable`1 cancellationToken)
at Microsoft.SqlServer.Management.Dac.DacWizard.ImportDatabase.DoWork()
at Microsoft.SqlServer.Management.TaskForms.SimpleWorkItem.Run()
I had the same issue and was able to resolve this with previous version of SSMS (SQL Server Management Studio) - not the SQL Server version. Previous SSMS versions can be downloaded here:
https://learn.microsoft.com/en-us/sql/ssms/release-notes-ssms?view=sql-server-ver15#1791
ATTOW, the current version is 18.5. It works for me at version 17.9.1 and 18.4.
This works for me on both SQL Server 2017 and 2019, it was the issue with SSMS, not the SQL Server version.
I also tried Azure Data Studio with SQL Dacpac extension (https://github.com/microsoft/azuredatastudio/tree/master/extensions/dacpac) and it failed with same error as latest SSMS version. There's an issue open for this: https://github.com/microsoft/azuredatastudio/issues/9522
Alternatively, instead of installing SSMS, install sqlpackage from https://learn.microsoft.com/en-us/sql/tools/release-notes-sqlpackage?view=sql-server-ver15#184-sqlpackage (version 18.4) and run the command manually. Something like:
sqlpackage.exe /a:Import /df:"import.log" /sf:"mybacpac-2020-04-26.bacpac" /tcs:"Server=.;Database=mybacpac;Integrated Security=true"
I ran into the exact same error message while attempting to import a BACPAC to my local SQL Server 2019. Exact same error on SQL Server 2017 through my testing. The import failed with the latest versions of SSMS and Azure Data Studio.
In my case the error was thrown due to the existence of an external contained user account in the database, principle type E. Type E is External user from Azure Active Directory.
You can check here for reference:
https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-database-principals-transact-sql?view=sql-server-ver15
After removing the user account from the database, I was able to import the database successfully.
Same error as well. I updated it to v18.9.2, instead of downgrading it and it resolved the issue

SQL Server 2012 error: object reference not set to an instance of an object

I use SQL Server 2012 and I have some databases on it. The problem is I suddenly get an error saying,
object reference not set to an instance of an object
I get this error when:
Going to write a new query
Select previously entered data by right click the table name ->
Select top 1000 rows
What I can do without getting error message:
Log into my instance successfully using both Windows Authentication mode and SQL Authentication mode.
Edit the table data by right click the table name -> Edit top 200 rows
Create a new database
I'm using:
Microsoft SQL Server Management Studio: 11.0.3128.0
Microsoft .NET Framework: 4.0.30319.34014
Operating System: Windows 8.1
Here are some snapshots of the error.
Please give me a solution to fix this problem. Your help will be highly appreciated.
I fixed the problem by running SSMS as administrator.
I could solve the error.
Repair the SQL Server.
Go to Add/remove programs Microsoft SQL Server 2012(x64) -> Uninstall/Change -> Repair.
Select the instance that you want to repair here.
For me, after repairing the instance, the error was solved.
Thanks for all who spent their valuable time to reply my question.
I got the same error message. Problem was 0 bytes free on the C: drive.
Its may be late, but i get the same error in SQL SERVER 2016, i resolved it by assigning full access to the back up folder.
I faced the same error once in my project. This is purely due to SSMS(sql client) is corrupted. Just for cross check that server is fine and client is corrupted, try to connect to the sql-server in this machine from any other server if you have access and query the tables. If it returns data, just uninstall and reinstall the client(ssms) to solve the issue
Thanks
I got the same error for SQL 2016 and the only solution for me was to completely uninstall (in appwiz.cpl) all entries Visual Studio + SQL. Then I executed VisualStudioUninstaller and I reinstalled SQL and after Visual Studio.
I got the same message when I try to alter table to add new column . Issue is I haven't enclosed data types using '[' datatype ']' . Its Real data type. But It got fixed when I enclosed in using square braces.
My solution for this was to extract the csv file with the python library pandas rather than saving it with Excel. Further, I removed columns that I didn't need as a few columns caused formatting errors during the import.
For those who are unable to modify their SQL configuration due to administrative restrictions at work:
I was able to open a new query page by creating a SQL Server Scripts project and adding a new query through the solution explorer
I got the message after deleting a database. The database was gone, so I moved on.

Index was outside the bounds of the Array. (Microsoft.SqlServer.smo)

I am using SQL Server 2008 R2. It is working fine. But recently, I have changed my hosting server and I came to know that they have installed SQL Server 2012 on Server.
Now, Issue is that after connecting with Server Database through SQL Server 2008 R2, When I click on any table name or Stored Procedure, I am getting error : Index was outside the bounds of the array. (Microsoft.SqlServer.smo)
So, is there any issue from my side or It is from Server Side ??? and How can I prevent this issue ?
Restarting the Management Studio worked for me.
Upgrade your SqlServer management studio from 2008 to 2012
Or
Download the service packs of SqlServer Management Studio and update probably resolve you solution
You can download the SQL Server Management studio 2012 from below link
Microsoft® SQL Server® 2012 Express http://www.microsoft.com/en-us/download/details.aspx?id=29062
For me this problem still exists with SSMS version 2016 (13.0.16100.1).
A decent workaround is to not use the 'Right click' -> 'Add table...' dialog, but simply drag the table you want to add from the Object Explorer, onto the Diagram surface. While dragging the mouse icon changes into an 'add' symbol and the table is added when you release the mouse.
Beats having to close SSMS every time.
Restarted worked!
I found the same error to add new table to my database diagram on sql server 2016, restarted sql server management studio, finally solved.
This is an issue if you are using 2008 management studio tools to connect to a SQL 2012 instance.
I experience this a lot if I am working on one server with SQL 2008, and trying to quickly query another server that is running SQL 2012.
I normally keep my personal workstation on the latest version of management studio (2012 in this case), and am able to administer all servers from there.
The Reason behind the error message is that SQL couldn't show new features in your old SQL server version.
Please upgrade your client SQL version to same as your server Sql version
Solution: Ignore the error
Just to show that the error does not do much in SSMS version 18.9.2, drag the table to be shown in the diagram from the Object Explorer tab and wait for it to finish loading before you start using it.
The suggested causes are now proven to be mostly impossible. I'm running SSMS V17.9.2 against SS 2014 and still have the problem. Memory problems have existed with this tool since at least 2006 when I started using SSMS.
Yes, MS 'wants' to get rid of diagramming but users won't let them. I have a feeling they will never fix any of these issues because they want users to be so fed up with the tool that enough of them quit using it and they can abandon it entirely.
Restarting is still a workaround if you can stand doing so numerous times per day.
you must use new version of Management Studio. And also you will got an error 29506. so you should run as Administrator for setup.
Look this site.
http://shareis.com/post/29506-management-studio-express
I had a similar experience with using SMO via C# with the stack trace:
[1896] System.IndexOutOfRangeException: Index was outside the bounds of the array.
[1896] at Microsoft.SqlServer.Management.Smo.BitStorage.SetBit(Int32 itemIndex, BitIndex bitIndex, Boolean value)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.AddObjectPropsFromDataReader(IDataReader reader, Boolean skipIfDirty, Int32 startColIdx, Int32 endColIdx)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ImplInitialize(String[] fields, OrderBy[] orderby)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Initialize(Boolean allProperties)
[1896] at Microsoft.SqlServer.Management.Smo.SqlSmoObject.OnPropertyMissing(String propname, Boolean useDefaultValue)
[1896] at Microsoft.SqlServer.Management.Smo.PropertyCollection.RetrieveProperty(Int32 index, Boolean useDefaultOnMissingValue)
[1896] at Microsoft.SqlServer.Management.Smo.PropertyCollection.GetValueWithNullReplacement(String propertyName, Boolean throwOnNullValue, Boolean useDefaultOnMissingValue)
[1896] at Microsoft.SqlServer.Management.Smo.Information.get_MasterDBPath()
It turned out my versions of the CLR/NCLI/SMO were 10.50.1600.1.
Upgrading them to 10.53.6000.34 fixed it - thus allowing the 2008R2 SMO to do many things with 2012 and 2014 servers.
Get them from the feature pack
https://www.microsoft.com/en-gb/download/details.aspx?id=44272
I found an issue with Diagram and Schema in SQL-Server 2016 that could be useful to the subject.
I was editing diagram (related to, and with lot of tables of, the "sales" schema) and added a new table, BUT forgot to declare it schema, so it was with the default "dbo". Then when I returned to, and opened up, the schema "sales" and tried to add an existent table... Bluf! THAT Triggered exactly the same error described in that thread.
I even tried the workaround (drag the table) but it didn't work. Suddenly I noticed that the schema was incorrect, I updated it, tried again, and Eureka! the problem was immediately away... Regards.
It's very old problem with cashed content. MS planning to remove diagrams from SSMS, so they don't care about this. Anyway, solution exists.
Just close Diagrams tab and open it again. Works with SSMS 18.2.
You have to use latest version with SSMS
You can check latest builds via this page
https://sqlserverbuilds.blogspot.com/

Crystal Reports :Database Logon Failed

I am trying to print crystal report in PDF format , and on my local machine it’s working fine. But when I publish application to the server, it’s giving me the following error on Print button .
I am using VS2012 , SQl Server 2012, IIS 7.5 and CR version 13.5
Note: I am using integrated security so I left username and password blank. Please help.
My lines of code:
string Constring1 = ConfigurationManager.ConnectionStrings["dbRMCConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(Constring1);
conn.Open();
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("RMCChallan.rpt"));
ParameterFieldDefinitions crParameterFieldDefinations;
ParameterFieldDefinition crParameterFieldDefination;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterValues.Clear();
crParameterDiscreteValue.Value = lbl_Cno.Text;
crParameterFieldDefinations = rpt.DataDefinition.ParameterFields;
crParameterFieldDefination = crParameterFieldDefinations[0];
crParameterValues = crParameterFieldDefination.CurrentValues;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefination.ApplyCurrentValues(crParameterValues);
rpt.SetDatabaseLogon("", "", "ADMIN-PC\\ADMIN", "dbRMC");
rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, Guid.NewGuid().ToString());
Thanks for your help in advance !! :)
Stack Trace:
I am trying to print crystal report in PDF format , and on my local machine it’s working fine. But when I publish application to the server, it’s giving me the following error on Print button .
I am using VS2012 , SQl Server 2012, IIS 7.5 and CR version 13.5
Note: Using windows authentication..No username and password assigned to my database.
Server Error in '/' Application.
Database logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Database logon failed.
Source Error:
Line 178: crParameterFieldDefination.ApplyCurrentValues(crParameterValues);
Line 179: rpt.SetDatabaseLogon("", "", "ADMIN-C\\ADMIN","MyDatabase");
Line 180: rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, Guid.NewGuid().ToString());
Line 181:
Line 182:
Source File: e:\25jan14\WebSite1\RMC.aspx.cs Line: 180
Stack Trace:
[COMException (0x8004100f): Database logon failed.]
CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +257
[LogOnException: Database logon failed.]
CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +332
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +310
CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +654
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) +92
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportOptions options, HttpResponse response, Boolean asAttachment, String attachmentName) +96
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportFormatType formatType, HttpResponse response, Boolean asAttachment, String attachmentName) +119
RMC.Button5_Click(Object sender, EventArgs e) in e:\25jan14\WebSite1\RMC.aspx.cs:180
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9553594
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
We had the same issue. Ended up that we needed to install the Microsoft SQL Server 2012 Native Client (available at https://www.microsoft.com/en-us/download/details.aspx?id=29065, click Install Instructions and scroll towards the middle).
We were able to tell this because Process Monitor was showing NOT FOUND errors accessing the HKCR/SNCL11 registry key.
1.clear dataset connection.
2.set table or tables.
3.don't set datasource and dataset. becuase you sent data to crystal report.
4.refresh the reportdocument.
see this in bottom:
MyCrystalReportSource.ReportDocument.DataSourceConnections.Clear();
MyCrystalReportSource.ReportDocument.Database.Tables[0].SetDataSource(MyDataSet.Tables[0]);
MyCrystalReportSource.ReportDocument.Refresh();
MyCrystalReportSource.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, HttpContext.Current.Response, true, reportTitle);
Are you sure you need two slashes?
rpt.SetDatabaseLogon("", "", "ADMIN-PC\\ADMIN", "dbRMC");
Also, here is a link to msdn refrence for SetDatabaseLogon.
http://msdn.microsoft.com/en-us/library/ms226065(v=vs.80).aspx
The sample in the article is using standard security login account.
rpt.SetDatabaseLogon("limitedPermissionAccount", "1234", "ServerName", "Northwind");
You are missing user and password in the call.
It is also like you are trying to perform a trusted connection. You could try using a local ODBC connection on the web server, but it might prompt the user for AD credentials.
Good luck
In case someone else also finds this question, here's what my problem was, and how I fixed it:
I had to edit some old reports in order to add a new table to them. As part of that process I had to create a new connection and change the table locations for the pre-existing tables. All worked well until trying to deploy to the production environment, where the table locations are dynamically changed in code.
So I Googled, found this question and realised that the answer by #Chet (+1) could be a clue. And it was - I had created the new connection as Sql server native client ##.
However, instead of messing with the prod server, I remade the new connection using an OLE DB (Sql server) connection, and then it worked in all relevant places (dev, test, prod envs).
i faced a similar problem recently, it worked when i changed the locale identifier of the db connection in the report. hope this helps someone. https://stackoverflow.com/a/35545586/3013470
I battled with this problem for weeks on and off trying to deploy a Click-Once app and finally found it to be that the client computer needed the SQL Native client installed for SQL 2012; so, I had to add that to my prerequisites.

Resources