VB.Net dynamic SQL WHERE DateField = ‘2012-12-13’ converts to US date and possibly throws error if then invalid

VB.Net dynamic SQL WHERE DateField = ‘2012-12-13’ converts to US date and possibly throws error if then invalid

Was only happening on Windows XP, possiby 32-bit computers.
Windows 7 64-bit were ok.

In this case it was against a view. Solved by changing view:

SELECT ts.JobSheetID
, CAST(js.DateMJSAASdatetime2(0)) AS DateMJSA
,js...
FROM

Unable to apply publish properties for item “ApplicationCode\SystemNames.xml”

Solved with thanks to:

http://stackoverflow.com/questions/9284375/unable-to-apply-publish-properties-for-item-x

“It appears that the issue is related to ClickOnce. Navigate to the project, right click on it and click on properties. Go to the Publish tab and click on Application Files. Check the ‘Show all files’ checkbox and scroll through the list of files. Eventually, you will come across the file that has a yellow exclamation point on it. This file is orphaned and needs to be removed. Right click on the file and there should be a remove option.

Now build the solution and the warning should be gone.”

Error: The multi-part identifier could not be bound. when using a function and alias

You cannot pass parameters to functions across a JOIN.

http://stackoverflow.com/questions/4123413/the-multi-part-identifier-columnname-could-not-be-bound

Use APPLY:

SELECT ROW_NUMBER() OVER(ORDER BY x.Year DESC, x.Month) AS ID,
x.*,
fr.*
FROM (
SELECT Client,
Month(TimeStamp) As Month,
Year(TimeStamp) As Year,
Day(TimeStamp) As Day,
(dateadd(yy,(Year(TimeStamp)-1900),0)
+ dateadd(mm,Month(TimeStamp)-1,0)
+ Day(TimeStamp)-1) AS XTimeStamp,
Sum(KwTop) As KwTop,
Sum(KwHeap) as KwHeap,
Sum(KwLow) As KwLow
FROM Ori.vEnergyUnion
GROUP BY
Year(TimeStamp), Month(TimeStamp),Day(TimeStamp), Client
) x
OUTER APPLY
(
SELECT *
FROM Finance.fGetRates(x.XTimeStamp) Fr
WHERE fr.ValidFrom = x.XTimeStamp
) fr

Visual Studio unable to copy file because it is being used by another process

 

To try and get around this I closed VS and re-opened it. Still the same problem. In this scenario I then closed it again and on inspection of Task Manager I found that devenv was still running as a process (it was not in Applications). After Killing this extra devenv my computer blue screened. After restarting itself I was able to open my solution and build.

WPF freezes when dragging data source onto a Page or Window

Problem

WPF freezes when dragging data source onto a Page or Window

Possible Solution

Inspect datasource and see if it has a child table underneath it. Does this child expand to show the parent table again. If so then you may be creating an infinite loop when dragging the datasource onto the Page or Window

TFS Build: Could not resolve this reference. Could not locate the assembly ”. Check to make sure the assembly exists on disk.

A TFS Build fails probably after a new reference has been added. Possibly a .exe reference

ERROR
TFS Build: Could not resolve this reference. Could not locate the assembly ‘<name>’. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors

SOLUTION
In Team Explorer > Builds > Build Explorer > Select broken build and double-click to work out which project did not build
Visual Studio > Projects > Project Dependencies > Select project that is not building > Add the required dependency > Confirm that the Build Order tab now shows this project higher than the project failing to build

Still did not work. Removed and added the reference again and it then worked.
The change in Source Control for the file was that the version no was in the broken version. not in the fixed version. Before here:

After here:

 

Visual Studio Macros “Cannot load the recording macro…”

Error
“Cannot load the recording macro project ” for the following reason:
‘C:\Users\<username>\Documents\Visual Studio 2010\Projects\VSMacros80\MyMacros\MyMacros.vsmacros’ is an invalid or inaccessible macro project file
Would you like to recreate it?”
Yes or No

Solved Answer No.
The problem may well be that you are not using C, maybe using D or another drive.

If looking in the wrong place then set the macro recording project to the other project then unload the current project. If necessary move any new created macro project to where you want it then open it. Repeat for samples.

Windows Forms DataBinding displays ‘System.Data.DataRowView’ in text boxes and other controls

ERROR

Windows Forms DataBinding displays ‘System.Data.DataRowView’ in text boxes and other controls

SOLVED

Was a ComboBox databinding pointing at a field no longer in the dataset.

Problem: Dataset with code behind repeatedly needs Run Custom Tool to compile

Maybe source code control put the vb code in the wrong place. The .vb code should be underneath the dataset in show all files, not alongside it.
Backup the current .vb code, then copy it to clipboard and delete it. Then go into the dataset and right-click > view code > then paste the code in there. The newly created .vb code file will now be behind and everything should work from now on.

Problem: Dataset does not generate Insert command

SOLVED today by:

Changing the select statement to SELECT * FROM then pull the fields in again.