SQL70001 error on a Visual Studio Database Project

I had a Visual Studio 2012 Database Project along with my Visual Studio Asp.Net Project abortion trimester for storing my Stored Procedures in TFS.  However whenever I tried to Build my Project I kept getting Error 2 SQL70001: This statement is not recognized in this context.  I had made sure that my Database Project wasn't included in the build process so why was I getting these errors. on line abortion pill  I then took a look at the properties of the Stored Procedures and noticed the following:-

The Build Action was set to Build!

So the fix was fairly easy, just change to None:-

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.