Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

Unable to open Database Project in Visual Studio 2012

Installed SQL Server 2012 Management Studio on my local PC and found out in Visual Studio 2012 medical abortion pill I could no longer open a SQL Server Data Project.  I kept getting the following error "Unable to open Database Project" from SQL Server Data Tools and both web links failed to bring risk of abortion pill up and solutions (infact they just 404'd).

 

The fix was to install the SQL Server Data Tools - quite simple really?

http://msdn.microsoft.com/en-us/jj650015

.Net Entity framework not adding SQL View

Whilst trying to add a SQL View to an Entity Framework Model I notice it wasn't being added.  Normally this is down to a table not having a Primary Key, but how do you add a Primary Key to a SQL View?  Well there is a simplier method to solving this issue and it is as follows:-

Say we had a simple Select:-

SELECT 'Data1F1' as Field1, 'Data1F2' as Field2

UNION ALL

SELECT 'Data2F1' as Field1, 'Data2F2' as Field2

Now this doesn't have an identity field or ID Primary Key so Entity Framework would reject this.  So lets add a ROW_NUMBER value:-

SELECT

ROW_NUMBER() OVER (ORDER BY Field1) as ID, *

FROM

(

SELECT 'Data1F1' as Field1, 'Data1F2' as Field2

UNION ALL

SELECT 'Data2F1' as Field1, 'Data2F2' as Field2

) as DataValues

 

However again Entity Framework doesn't like this because the ROW_NUMBER is actually returning a Nullable field.  So now we need to how much for abortion convert this into a NOT NULL Value.  To do this we just change the first SELECT:-

From

ROW_NUMBER() OVER (ORDER BY Field1) as ID, *

To

ISNULL(ROW_NUMBER() OVER (ORDER BY Field1),0) as ID, *

 

The ISNULL makes sure pregnancy pills there are no nulls because we are returning a Zero if there are and SQL interprets this as a NOT NULL field.

Now we can finally add this SQL View to our Entity Framework model.

Linq NullReferenceException on Where Clause

Had a strange error when running a similar query taking data from SQL Server:-

 var returnData = from selectedData in dataTable.AsEnumerable()

 where selectedData.Field<string>("ProductCategory").Trim().ToUpper() == all about abortion "CAT1"

 select selectedData

 

Error was:-

NullReferenceException abortion pill info was unhandled - Object reference not set to an instance of an object

And in debugger it was pointing to the where clause.  After lots of looking around it was because the field "ProductCategory" being returned from SQL Server was returning some nulls in the data.

The Fix:-

Use the ?? operator (see http://msdn.microsoft.com/en-us/library/ms173224.aspx)

var returnData = from selectedData in dataTable.AsEnumerable()

where (selectedData.Field<string>("ProductCategory") ?? "").Trim().ToUpper() == "CAT1"

select selectedData

 

SharePoint 2010 Visual Web Parts - Specified path, file name, or both are too long Error

Whilst trying to deploy a newly created SharePoint 2010 Visual Web Part I came across this lovely error:-

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

It abortion pill info is a bit of a strange error as I'm not sure why having a long name would create such an error.  However the fix was quite simple for me, just make sure the fully directory name + abortion doctors project name + files are not longer than 248 characters.  A lot of people seem to put their projects in something like C:\Users\Celtic_Coder\Documents\Visual Studio 2010 which is already using up 50 character from that 248 character limit!

Visual FoxPro SELECT UNION and ORDER BY

Found a lovely weirdy in Visual FoxPro 7 and using UNION and ORDER BY, try the following:-

SELECT Field1, Field2 FROM Table1;

UNION ALL ;

SELECT Field1, Field2 FROM Table2;

ORDER BY Field2;

INTO CURSOR Table3

This statement creates the error:-

SQL: ORDER BY clause is invalid.

This is perfectly good SQL syntax so why is FoxPro not allowing it? 

Well not sure why by a way around it is using the ORDER BY with abortion pill ny a field value so the code best pills would now be:-

SELECT Field1, Field2 FROM Table1;

UNION ALL ;

SELECT Field1, Field2 FROM Table2;

ORDER BY 2;

INTO CURSOR Table3

SharePoint read-only mode

Had a interesting issue, our WSS 3.0 (SharePoint) internal site wasn't allowing users to upload/edit or delete files in the document library.  On closer inspection everything was correct with the library permissions.  Then I noticed the "View All Site Content" hyperlink was also missing.  So what had happened to SharePoint?  Well it seemed the morning's backup had failed and SharePoint had placed the site in a read only state (I presume to protect users adding more content when we didn't have a good previous backup file).

The Fix:-

Open SharePoint 3.0 Central Administration

Select "Application Management tab"

Under "SharePoint Site Management" section - select "Site collection quotas and locks" hyperlink

Under the how much is abortion "Site Lock Information" section is something other than "Not Locked" otc abortion pill selected (ours was set to Read-only (blocks additions, updates, and deletions).

Just tick "Not locked" and your site should now work correctly.

SharePoint JavaScript issues

A custom bit of code using JavaScript wasn't firing within WSS 3.0 (SharePoint) but only a handful of internal users.  TDD When looking at their computer I notice a script error in abortion places IE:-

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3)

Message: Library not registered.

Line: 1946
Char: 4
Code: 0
URI: http://Portal/_layouts/1033/init.js?rev=yOq8IoAABYCtaZjMVrjxtg%3D%3D

It seems that when Outlook 2003 was uninstalled and Outlook 2010 was installed a dll gets unregistered and not re-registerd again.  The file is called name.dll.

So to Fix:-

In CMD navigate to:-
C:\Program Files (x86)\Microsoft Office\Office14

And run the following command:-
Regsvr32 name.dll

Then close all IE windows and try it again and all should be good.

Permission error with Dynamics AX 2012 and SSRS 2008 r2 report

When trying to run FreeTextInvoice.Report from Dynamics AX 2012 using SSRS 2008 r2 keep getting the following error whilst trying to print:-

Error while setting server report parameters. Error message: The permissions granted to user 'TestUser' are insufficient for performing this operation. (rsAccessDenied)

Stack trace: Call to TTSCOMMIT without first calling TTSBEGIN.

Stack trace

(S)\Classes\CustPrintOutInvoice\printOut - line 123
(C)\Forms\CustFreeInvoiceListPage\Methods\printInvoice
(C)\Forms\CustFreeInvoiceListPage\Designs\DesignList\PrintSelected\Methods\Clicked

Also looking at SQL Server 2008 how to get a abortion abortion pill online r2 SSRS Log files at:-
C:\Program Files\Microsoft SQL Server\ServerName\Reporting Services\LogFiles

ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: , Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'TestUser' are insufficient for performing this operation.;

Fix was quite easy but not obvious to find:-

Bascially check all folder permissions and that they are inheriting from the root.

e.g. this particular report FreeTextInvoice.Report is contained within the DynamicsAX/StaticReports/en-GB (and other languages).  But for some reason this folder didn't inherit the permissions from the root (DynamicsAX).

So all I do is navigate to the folder and then click the "Revert to Parent Security".