Thursday, June 20, 2013

Could not load file or assembly error in VS 2010 and CR






when u received this kind of error


"Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified."


Solution: 
  1. First, set your framework to 4.0 full, not the client. CR requires access to the full framework.

  2. Then add this to your app.config:
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
 


try to add this to your .config file (usually app.config)


< startup useLegacyV2RuntimeActivationPolicy="true">
< supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
< /startup>


PS: don't forget to remove extra space after "<" because blogger need the extra space so it can display correctly

Fix problem “The ‘VSTS for Database Professionals Sql Server Data-tier Application’ package did not load correctly”


“The ‘VSTS for Database Professionals Sql Server Data-tier Application’ package did not load correctly”



Visual Studio 2010 and SQL Server Express have an uneasy alliance, at best.  When you install Visual Studio 2010 it installs SQL Server Express 2008 for you, but only the database engine, not SQL Server Management Studio.  If you mess with SQL Server Express in order to install the management tools, or upgrade to 2008 R2, or install the Advanced Services version, things break and you can no longer reliably use the Visual Studio database projects.
In particular, if you remove SQL Server Express 2008 and install SQL Server Express 2008 R2, you’ll probably run into an issue where if you try to open a schema object in a Visual Studio database project you’ll get an error that says:
The ‘VSTS for Database Professionals Sql Server Data-tier Application’ package did not load correctly.
The fix for this problem can be found here.  Here’s the short version:
  1. Locate your Visual Studio 2010 installation media.
  2. In the \WCU\DAC folder, you’ll find three MSIs: DACFramework_enu.msi, DACProjectSystemSetup_enu.msi, and TSqlLanguageService_enu.msi.  Run and install each of them.
  3. Reapply Visual Studio 2010 SP1.
You should be back to a working state.

Fixed Problem “The ‘VSTS for Database Professionals Sql Server Data-tier Application’ package did not load correctly”

“The ‘VSTS for Database Professionals Sql Server Data-tier Application’ package did not load correctly”

After long time, I have got some relax from work pressures. I have got lots of mail about several issues. I had tried to give them hot fix with in a very short time. Sorry to everyone for my late response.

Today, when I am setting my new laptop I have faced a problem in VS 2010. Just run the VS2010 and got the error,
The ‘VSTS for Database Professionals Sql Server Data-tier Application’ package did not load correctly.
I don't understand why this is happening?

Potential cause:
This problem may occur due to install SQL Server Express 2008 with Visual Studio 2010 installation. When install SQL Server 2008 r2 on the same machine I had got an exception. So that I have uninstalled SQL Server Express 2008 from machine and then install SQL Server 2008 r2 but installation not completed successfully.

Solution 1:
I have got the solution from this link.
To fixed my problem I did the following tasks

Step-1: Run the Visual Studio 2010 Ultimate  disc
Step-2: Explore  \WCU\DAC folder from disc
Step-3: Now installed the three packages from the Visual Studio 2010 Ultimate disc and it fixed the problem right away for me.

Microsoft SQL Server 2008 R2 Data-Tier Application Framework with this command:
\WCU\DAC\DACFramework_enu.msi

Microsoft SQL Server 2008 R2 Data-Tier Application Project:
\WCU\DAC\DACProjectSystemSetup_enu.msi

Microsoft SQL Server 2008 R2 Transact-SQL Language Service:
\WCU\DAC\TSqlLanguageService_enu.msi

If required you can re-install the Visual Studio 2010 Service pack 1.



Solution 2:
You can also try with this solution though it is not tested
1. Open Visual studio 2010 command prompt
2. Right click on it to run as an Administrator
3. execute this command:  devenv.exe /resetskippkgs

FYI: For latest Microsoft SQL Server Data Tools visits here.

Wednesday, June 19, 2013

Download Crystal Reports for Visual Studio 2012





By default, Visual Studio doesn’t come with Crystal Reports. Microsoft has now its own reporting tool with an .rdlc extension. In order to use Crystal Reports for Visual Studio, you need to download it from SAP’s website.
Crystal Reports is now called “SAP Crystal Reports, developer version for Microsoft Visual Studio” and can be downloaded at http://scn.sap.com/docs/DOC-35074.
The current version as at the time of this writing is 13.0.5. You may need to visit the link above to get the latest release.



Download Crystal Reports 2010 for Visual Studio Now


Supported Operating Systems

Design Time

The following operating systems shall be supported for design time scenarios (i.e., in development environments).  Each operating system shall be supported in both 32-bit and 64-bit versions (as supported by the operating system).
  • Windows Vista SP2
  • Windows XP SP3 Professional
  • Windows Server 2003 SP2
  • Windows Server 2003 R2
  • Windows 7
  • Windows Server 2008 R2

Runtime

The following operating systems shall be supported for runtime scenarios (i.e., deployment/client environments).  Each operating system shall be supported in both 32-bit and 64-bit versions (as supported by the operating system).
  • Windows Vista SP2
  • Windows XP SP3 Professional
  • Windows Server 2003 SP2
  • Windows Server 2003 R2
  • Windows 7
  • Windows Server 2008 R2

Minimum Hardware Requirements

  • Crystal Reports for Visual Studio is supported running on 32-bit versions of Windows running on x86 and x64 CPUs made by AMD and Intel.
  • Crystal Reports for Visual Studio is supported running on 64-bit versions of Windows running on x64 CPUs made by AMD and Intel.

Design Time

  • 1.6Ghz or faster processor,
  • 1 GB (32 Bit) or 2 GB (64 Bit) RAM ,
  • 650MB (32-bit) or 1.1GB (64-bit) available hard drive space

Runtime

  • Intel Pentium III or faster processor,
  • 512 MB RAM, 
  • 300MB (32-bit) or 325MB (64-bit) available hard drive space
Unfortunately only Visual Studio 2010 is supported. Well, I think it’s not actually a big deal. Since other version like 2008 and below has built-in Crystal Reports.
Download now at share your experience here. You may also wish to share your source code and promote yourself to the programmer’s community.
Happy coding!

Tuesday, June 18, 2013

Convert Number to Roman Numerals in Sql Serve

CREATE FUNCTION fnConvertIntToRoman(@i INT)
RETURNS VARCHAR(100)
AS
BEGIN
RETURN Replicate('M', @i/1000)
+ REPLACE(REPLACE(REPLACE(
Replicate('C', @i%1000/100),
Replicate('C', 9), 'CM'),
Replicate('C', 5), 'D'),
Replicate('C', 4), 'CD')
+ REPLACE(REPLACE(REPLACE(
Replicate('X', @i%100 / 10),
Replicate('X', 9),'XC'),
Replicate('X', 5), 'L'),
Replicate('X', 4), 'XL')
+ REPLACE(REPLACE(REPLACE(
Replicate('I', @i%10),
Replicate('I', 9),'IX'),
Replicate('I', 5), 'V'),
Replicate('I', 4),'IV')

END

How to recover corrupted database file( .mdf .ldf).

EXEC sp_configure 'allow updates',1

RECONFIGURE WITH OVERRIDE

UPDATE sysdatabases SET status=1073741840 WHRE name='DatabaseName'

CHECKPOINT--shutdown with nowait

DBCC traceon(3604)

DBCC rebuild_log ('DatabaseName', 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\DatabaseName_Log.LDF')


USE DatabaseName
sp_dboption 'DatabaseName', 'single_user', 'true'

ALTER DATABASE DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

DBCC CHECKDB (DatabaseName, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS

USE MASTER

UPDATE sysdatabases SET status = 0 WHERE name = 'DatabaseName'

DBCC CHECKALLOC ('DatabaseName')

DBCC CHECKDB ('DatabaseName')

sp_dboption 'DatabaseName', 'single_user', 'false'

USE MASTER

sp_configure 'allow updates', 0

EXEC sp_resetstatus DatabaseName