Sunday, August 31, 2014

Shared Dataset for SSRS - Data Defaults

I have a shared dataset in an SSRS reporting project that is used to create some date defaults to use as parameters in reports. Here is the query:



SELECT 'Calendar ' + CONVERT(varchar(4), YEAR(CurrentDate)) AS CurrentCalendarYear,
'[Time].[Year - Month].[Year].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-01-01T00:00:00]' AS CurrentCalendarYearMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Year].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-01-01T00:00:00]' AS CurrentCalendarYearExMDX,
CAST(DATENAME(month, CurrentDate) AS varchar(10)) + ' ' + CONVERT(varchar(4), YEAR(CurrentDate)) AS CurrentMonth,
'[Time].[Year - Month].[Month].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(CurrentDate)), 2) + '-01T00:00:00]' AS CurrentMonthMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Month].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(CurrentDate)), 2) + '-01T00:00:00]' AS CurrentMonthExMDX,
'Calendar ' + CAST(YEAR(LastMonth) AS varchar(5)) AS PreviousMonthCalendarYear,
'[Time].[Year - Month].[Year].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-01-01T00:00:00]' AS PreviousMonthCalendarYearMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Year].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-01-01T00:00:00]' AS PreviousMonthCalendarYearExMDX,
CAST(DATENAME(month, LastMonth) AS varchar(10)) + ' ' + CAST(YEAR(LastMonth) AS varchar(5)) AS PreviousMonth,
'[Time].[Year - Month].[Month].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(LastMonth)), 2) + '-01T00:00:00]' AS PreviousMonthMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Month].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(LastMonth)), 2) + '-01T00:00:00]' AS PreviousMonthExMDX
FROM (SELECT GETDATE() AS CurrentDate, DATEADD(month, - 1, GETDATE()) AS LastMonth) AS d

What I'd also like to do is update the query to return the current week and the previous week. AS far as I can tell, there is no function in T-SQL to return week - it apparently takes some formatting.


If someone could provide some insight in to how to make this work, it would be greatly appreciated. It needs to be in the format of 27-July-2014.


Thanks!




A. M. Robinson


Shared Dataset for SSRS - Data Defaults

By "Week", I mean what week of the month it is, as I provided in my example.


The week of August 3rd, the week of August 10th, etc. This is a concept that can be found in MDX and Analysis Services. It's a pretty standard thing. I have not found anything similar to this construct that is native to T-SQL. I cannot do something similar in T-SQL.


What I don't need is just the number of the week in the year. Again, I've found nothing similar in T-SQL. I've only seen Month and Year functions.


This is what MDX returns with regards to Week:





A. M. Robinson


Shared Dataset for SSRS - Data Defaults

Hi Robinson,


Try this.




sathya - http://ift.tt/K0aCLw ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.


Shared Dataset for SSRS - Data Defaults

/thanks for the reply, but the code sample you included does not give me what I'm looking for...


I don't need to know the week number or whether or not a day is a weekday or weekend. I am looking for the same construct as you would find in SSAS - a date that gives the beginning of the week. Every week start on a Sunday.


I am trying to do the same thing in SQL Server, and again, from what I have seen the only two built in functions for SQL Server for getting anything similar is MONTH or YEAR.


I also am not hardcoding dates. As you can see in the code example I posted, I am taking the current date, NOT hard coded dates.




A. M. Robinson


Shared Dataset for SSRS - Data Defaults

Again...I am just trying to add an additional line to my code that is similar to the other statements in the sample I provided. I am not looking to rewrite or alter the original code at all.


What you are suggesting does not actually get me what I want. Your query is giving me every single day in a year or date range. That is not what I originally asked for. Again, if you look at my original post, I am only concerned with the CURRENT DATE. Your code just returns the components of a date. Could be useful in some other case, but not in mine.


Please refer back to my original post to see what I'm referring to.




A. M. Robinson


Shared Dataset for SSRS - Data Defaults


Again...I am just trying to add an additional line to my code that is similar to the other statements in the sample I provided. I am not looking to rewrite or alter the original code at all.


What you are suggesting does not actually get me what I want. Your query is giving me every single day in a year or date range. That is not what I originally asked for. Again, if you look at my original post, I am only concerned with the CURRENT DATE. Your code just returns the components of a date. Could be useful in some other case, but not in mine.


Please refer back to my original post to see what I'm referring to.




A. M. Robinson



So are you looking out for this?



DECLARE @StrDt datetime='20140101'

;With CTE
AS
(
SELECT @StrDt AS Dt
UNION ALL
SELECT Dt + 1
FROM CTE
WHERE Dt+1 <'20150101'
)
SELECT CASE WHEN DATEADD(dd,DATEDIFF(dd,0,Dt)/7*7,-1) < @StrDt THEN @StrDt ELSE DATEADD(dd,DATEDIFF(dd,0,Dt)/7*7,-1) END
FROM CTE
GROUP BY DATEADD(dd,DATEDIFF(dd,0,Dt)/7*7,-1)

OPTION (MAXRECURSION 0)



I've just given example for one year but you can extend to any number of years you want




Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


Shared Dataset for SSRS - Data Defaults

This is getting closer, but again - I don't want results for an entire year or a range of dates.


I just want the current week and the past week based on the current date. Also, I'm not going to be passing in parameters - it's a straight select based on the current data as defined by this line in the original code:



FROM (SELECT GETDATE() AS CurrentDate



A. M. Robinson


Shared Dataset for SSRS - Data Defaults


If someone could provide some insight in to how to make this work, it would be greatly appreciated. It needs to be in the format of 27-July-2014.




Hi Ansonee,


According to your descripton, you want to get the current week and previous week using the format 27-July-2014.


In this case, you can use a expression below to get this value in the parameter, and then use this parameter in the shared dataset.

Current Week:=datepart("ww",today())&"-"&MonthName(month(today()))&"-"&Year(today())

Previous Week:=datepart("ww",DateAdd("d",-7,today()))&"-"&MonthName(month(today()))&"-"&Year(today())


Regards,




Charlie Liao

TechNet Community Support



CSR for Group

Hi,


Thanks for your sharing.


Cheers,


Jason




Jason Guo

TechNet Community Support



Any one give me the basic idea on migrating lotus notes to SharePoint?

Hi All,


Any one give me the basic idea on migrating lotus notes to SharePoint?


Thanks in advance!


Any one give me the basic idea on migrating lotus notes to SharePoint?

You can check some of the useful links below to understand the migration process.


Below one is three part series explains about the basics, preparing the inventory which need to be migrated and migration process


http://ift.tt/1u5gJ3m


http://ift.tt/1wYKirL


Below one explains the tools required and the practices while doing the migration from Lotus notes to SharePoint


http://ift.tt/1u5gLZ2




My Blog- http://ift.tt/1aw9F9W|

If a post answers your question, please click Mark As Answer on that post and Vote as Helpful


Modify permissions on a document center site

I don't see a tab for "Documents"...only have tabs for "Browse" / "Page" / "Files" / "Library"


Is there some sort of configuration change I need to make to "enable" the "Documents" tab to display?


Modify permissions on a document center site

Hi,


Did you create a document library?


If so, when you open the library, it will has the "Documents" tab.


Best Regards,


Linda Li




Linda Li

TechNet Community Support



[Win8.1]StreamSocket cannot suppot WPAD(Web_Proxy_Autodiscovery_Protocol)?

I have got a proxy connection problem, list 2 proxy types with different connected APIs below:


1. Connecting to standard proxy server, setup proxy server/port in IE, import via netsh and pass credential in IE


1.a System.Net.Http.HttpClient (connected, works fine)



handler = new System.Net.Http.HttpClientHandler();
handler.Proxy = WebRequest.DefaultWebProxy;
handler.Proxy.Credentials = CredentialCache.DefaultCredentials;
client = new System.Net.Http.HttpClient(handler);


1.b Windows.Web.Http.HttpClient (connected, works fine)



client = new Windows.Web.Http.HttpClient();


1.c StreamSocket (connected, works fine)




System.Uri uri = new Uri("http://ift.tt/xPIXNj;);
ProxyConfiguration pc = await NetworkInformation.GetProxyConfigurationAsync(uri);
// pc.CanConnectDirectly = false
StreamSocket client = new StreamSocket();




2. Connecting to WPAD proxy server, no setting required, pass the credential in IE, connected to internet (http://ift.tt/14xxxHA)


2.a System.Net.Http.HttpClient (connected, need to create the credential manually)



handler = new System.Net.Http.HttpClientHandler();
handler.Proxy = WebRequest.DefaultWebProxy;
handler.Proxy.Credentials = new NetworkCredential("username", "password");
client = new System.Net.Http.HttpClient(handler);


2.b Windows.Web.Http.HttpClient (connected, works perfect)



client = new Windows.Web.Http.HttpClient();



2.c StreamSocket (cannot connect, 407 Proxy authentication required)



System.Uri uri = new Uri("http://ift.tt/xPIXNj;);
ProxyConfiguration pc = await NetworkInformation.GetProxyConfigurationAsync(uri);
// pc.CanConnectDirectly = true <---- cannot detect the proxy server

StreamSocket client = new StreamSocket();



===


My question is that with the case 2.c, the CanConnectDirectly is true means StreamSocket cannot detect proxy to connect.


Is this a bug? or do i miss any settings?


===


PS: case 2, cannot detect proxy via netsh, too




netsh winhttp import proxy source=ieCurrent WinHTTP proxy settings:
Direct access (no proxy server).




Best Regards.





Strange performance issue in SSRS SharePoint integrated / Kerberos

Hi Ranier,


Since we haven't got any reply from you, we will close this thread. If you still have any questions, you could open a new thread.


Regards,


Doris Ji


Designing an app that retrieves news from the google news (or) news from the internet to my windows 8.1 mobile application. Help me with the articles or the ways to solve it up

i want to design a windows 8.1 mobile application which will retrieve data from the internet like google news ....


what are the steps i need to follow to do that application. help me in doing that application. please provide me with some articles so that i can understand better.


thank you in advance



Where is Windows.Web.Http

Hi,


I need to use Windows.Web.Http in my application but when I can't find the associated dll on my PC when I try and add it as a reference to my app. Where is it? Do I have to download an sdk?


Thanks


Jeff


Where is Windows.Web.Http

Sorry, found what I was doing wrong. I needed to create a windows store app, once I did I could add in windows.web.http.

Where is Windows.Web.Http

That's true, Windows.Web.Http is a Windows Store App Api.


--James




<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>

Thanks

MSDN Community Support



Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


CSR for Group

HI, colleagues!


I have a code CSR



overrideCtx.Templates.Group = CustomGroup;
overrideCtx.Templates.Item = customItem;

and


function CustomGroup(ctx, group, groupId, listItem, listSchema, level, expand) {

//var html = '<ul id="list1">' + listItem[group] + '</ul>';
html = '<ul id="list1">' + listItem[group] + listItem;
html += '</ul>';

return html;

}


function customItem(ctx) {
var ret = "<li><div>" + ctx.CurrentItem.Title + "</div></li>";
return ret;

}



but it generates separate blocks


<ul id="list1">123</ul>
<li>
<div>123</div>
</li>
<li>
<div>123</div>
</li>

how to make the blocks were elements within the block groups like this


<ul id="list1">123
<li>
<div>123</div>
</li>
<li>
<div>123</div>
</li>
</ul>


How to get the user-agent with C#?

Hi All,


I have a question about how to get the client user-agent with C#? I have tried the code flowering,but it does not work.


HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

string agent = request.UserAgent;


Any suggestions?


Thanks,


Leslu


How to get the user-agent with C#?

Web api?


It's stored in the webheadercollection.


You could try:



if (Request.Headers.Contains("User-Agent"))
{
var headers = request.Headers.GetValues("User-Agent");

StringBuilder sb = new StringBuilder();

foreach (var header in headers)
{
sb.Append(header);

// Re-add spaces stripped when user agent string was split up.
sb.Append(" ");
}

userAgent = sb.ToString().Trim();
}





Hope that helps

Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


How to get the user-agent with C#?

Thanks Caillen. I do it in a console application. Is it possible to get the user-agent string from local machine? Just like input "javascript:alert(navigator.userAgent)" in the browser address. I want to get the value from C#.





Drawing a 3d curve in visual studio

Update: i found a library called 3dtools, and it works pretty good.

Why when i drag the mouse with the left button pressed to the right first time it's not drawing anything ?

I saw now that it also happen when i drag the mouse to the left first time after running the program.


It's not showing anything. But after leaving the left mouse button then click on it and drag the mouse again then it's showing what i draw in real time.


The question is why when im running the program first time it's not showing it ?


Reading output from console through asp.net

I am using this code to pass two numbers as input to an .exe of a C program file through asp.net and after that trying to read the output from console. I am having problem to read any output from the console. My asp.net code is.



string returnvalue;

Process p = new Process();

p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.StartInfo.FileName = ("C:\\Users\\...\\noname01.exe");
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
Thread.Sleep(500);
SendKeys.SendWait("1");
Thread.Sleep(500);
SendKeys.SendWait("~");
Thread.Sleep(500);
SendKeys.SendWait("2");
Thread.Sleep(500);
SendKeys.SendWait("~");
Thread.Sleep(500);

StreamReader sr = p.StandardOutput;

returnvalue = sr.ReadToEnd();

System.IO.StreamWriter file = new System.IO.StreamWriter("C:\\...\\StudentOutput.txt");
file.WriteLine(returnvalue);

My C code to which am passing inputs is.


#include<stdio.h>

int main()
{
int a, b, c;

printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);

c = a + b;

printf("Sum of entered numbers = %d\n",c);

return 0;
}



I am having problem to read any output from the console.


Reading output from console through asp.net

You should be using an ASP.NET WCF Web service to communicate between the Console application and an ASP.NET solution. The Console application would be the client to the ASP.NET WCF Web service. And you can pass data between the two easily.


http://ift.tt/10QDE2B


http://ift.tt/1hotEI3


http://ift.tt/OZjfE1


http://ift.tt/UssroJ


Reading output from console through asp.net

Actually that C program file is submitted by the student on my Website that is developed in Asp.net


and i have to pass some certain inputs to the program in order to grade it.


Just simply tell me that why it isn't reading any ouput from the console


Reading output from console through asp.net

But when i assign the output of the console to some label on the default page it doesnt work either and still shows nothing

Reading output from console through asp.net

But when i assign the output of the console to some label on the default page it doesnt work either and still shows nothing


http://forums.asp.net/


The above for is where you need to post for ASP.NET issues.


Interesting SQL Programming Problem

The less obstructive way to achieve this is to create a view that contains the latest student status, for instance...



CREATE VIEW vStudent
AS
SELECT Name, Semester, Status FROM Student
WHERE Semester = (SELECT MAX(B.Semester) FROM Student B WHERE Student.Name = B.Name)






and join with that table. Am assuming a lot about your structure but in order to get better help you need to post the related schema.

Interesting SQL Programming Problem

The task itself is rather simple.


However, the description makes it look much more complicated than it really is....


We don't have any table definition, sample data, nor expected result.


All there is is a written explanation.


Please provide ready to use sample data and show us what you've tried so far.


We're here to help. Not to do the tasks assigned to you.


Interesting SQL Programming Problem

Another solution you can have is to add an Active bit column. Every time you insert a student that give it the default value of '1' and at the same time UPDATE all this column to '0' for all other rows you have for that student that are '1'. You can do that with a trigger (before insert) or you would need an extra ID row (IDENTITY).


You also need to perform extra logic in case of DELETE but that way you won't need a subquery any more and you can have all the active students with their correct status by:


SELECT * FROM Students WHERE Active = 1


WHERE Clause with CASE WHEN....THEN....ELSE ... END with columns = > and IS NULL conditions

A CASE expression returns a scalar. I am sure you know, that "IS NULL OR > 0" does not resolve to a scalar value.


You could replace it with "SourceID", so you would get



WHERE SourceID = CASE WHEN @intSourceID > 0 THEN @intSourceID ELSE SourceID END

This will work fine if SourceID does not contain NULL in any row. If it does, those rows would always be filtered out.


If you need to support NULL values (or if you prefer this approach), you could circumvent that by writing the following. It assumes that you will always leave @intSourceID NULL if you don't want to filter (forget about the nonsense of using "either" NULL or 0)



WHERE (SourceID = @intSourceID OR @intSourceID IS NULL)





Gert-Jan


Interesting SQL Programming Problem

Another solution you can have is to add an Active bit column. Every time you insert a student that give it the default value of '1' and at the same time UPDATE all this column to '0' for all other rows you have for that student that are '1'. You can do that with a trigger (before insert) or you would need an extra ID row (IDENTITY).


You also need to perform extra logic in case of DELETE but that way you won't need a subquery any more and you can have all the active students with their correct status by:


SELECT * FROM Students WHERE Active = 1


Reading output from console through asp.net

Actually that C program file is submitted by the student on my Website that is developed in Asp.net


and i have to pass some certain inputs to the program in order to grade it.


Just simply tell me that why it isn't reading any ouput from the console


Lunching an application on a remote server, using the remote server's resources

Can anyone shed some light on how to achieve my goal?


http://ift.tt/OZjfE1


http://ift.tt/UssroJ


Interesting SQL Programming Problem

The less obstructive way to achieve this is to create a view that contains the latest student status, for instance...



CREATE VIEW vStudent
AS
SELECT Name, Semester, Status FROM Student
WHERE Semester = (SELECT MAX(B.Semester) FROM Student B WHERE Student.Name = B.Name)






and join with that table. Am assuming a lot about your structure but in order to get better help you need to post the related schema.

Interesting SQL Programming Problem

The task itself is rather simple.


However, the description makes it look much more complicated than it really is....


We don't have any table definition, sample data, nor expected result.


All there is is a written explanation.


Please provide ready to use sample data and show us what you've tried so far.


We're here to help. Not to do the tasks assigned to you.


Learn about .Net performance for a Beginner

Hello,


No such a thing as performance for beginners simply because it's pretty involved and broad subject and like all the advanced topics it should come last, it's simple.




Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.


Reading output from console through asp.net

You should be using an ASP.NET WCF Web service to communicate between the Console application and an ASP.NET solution. The Console application would be the client to the ASP.NET WCF Web service. And you can pass data between the two easily.


http://ift.tt/10QDE2B


http://ift.tt/1hotEI3


http://ift.tt/OZjfE1


http://ift.tt/UssroJ


Can you customize Print functionality to only print some portion in SSRS?

Really loving the way you guys mark your own responses as answers.


It really encourages community participation.




Thanks! Josh


Any one give me the basic idea on migrating lotus notes to SharePoint?

Hi All,


Any one give me the basic idea on migrating lotus notes to SharePoint?


Thanks in advance!


For Code Wise what is the difference between SharePoint list and SharePoint Document Library?

Hi All,


For Code Wise what is the difference between SharePoint list and SharePoint Document Library?


Thanks in advance!


HTTP 500 - Internal Server error - After restarting Microsoft SharePoint Foundation Web Application

Hello Priyanavasree,


Do you still get that error after the IIS reset? What do you see for errors in the Event viewer and ULS log?




- Dennis | Netherlands | Blog | Twitter


HTTP 500 - Internal Server error - After restarting Microsoft SharePoint Foundation Web Application

Hi Priya,


I recommend to use PowerShell command to stop the Microsoft SharePoint Foundation Web Application service and then start it again to see if the issue still occurs:


Stop the service:


$svc = Get-SPServiceInstance | where {$_.TypeName -like "*Foundation Web*"}


$svc.Status = "Offline"


$svc.Update()


Start the service:


$svc = Get-SPServiceInstance | where {$_.TypeName -like "*Foundation Web*"}


$svc.Status = "Online"


$svc.Update()


In order to get virtual directories back run this PowerShell command:


$wa = Get-SPWebApplication http://webAppUrl


$wa.ProvisionGlobally()


Best regards.


Thanks




Victoria Xia

TechNet Community Support



HTTP 500 - Internal Server error - After restarting Microsoft SharePoint Foundation Web Application

HI Priya,please check the below URL that related to the issue.


http://ift.tt/1ngUrGM




Anil Avula[MCP,MCSE,MCSA,MCTS,MCITP,MCSM] See Me At: http://ift.tt/1qhcz87


Reading output from console through asp.net

I am using this code to pass two numbers as input to an .exe of a C program file through asp.net and after that trying to read the output from console. I am having problem to read any output from the console. My asp.net code is.



string returnvalue;

Process p = new Process();

p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.StartInfo.FileName = ("C:\\Users\\...\\noname01.exe");
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.Start();
Thread.Sleep(500);
SendKeys.SendWait("1");
Thread.Sleep(500);
SendKeys.SendWait("~");
Thread.Sleep(500);
SendKeys.SendWait("2");
Thread.Sleep(500);
SendKeys.SendWait("~");
Thread.Sleep(500);

StreamReader sr = p.StandardOutput;

returnvalue = sr.ReadToEnd();

System.IO.StreamWriter file = new System.IO.StreamWriter("C:\\...\\StudentOutput.txt");
file.WriteLine(returnvalue);

My C code to which am passing inputs is.


#include<stdio.h>

int main()
{
int a, b, c;

printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);

c = a + b;

printf("Sum of entered numbers = %d\n",c);

return 0;
}



I am having problem to read any output from the console.


Avoid Page refresh after Parameter Selection

Hi HCMJ,


According to your description, you want to avoid page refresh after you select a value in parameter dropdown list. Right?


In Reporting Servcies, when you apply parameters, if there are no cascading parameter, it will not auto refresh the report if you select Never Refresh in Advanced tab. As we tested in our local environment, it will not refresh until we click View Report. So in this sceanrio, please check the parameter dependencies and try to apply filters instead of using parameters in query directly. Also please take a reference to the links below:


http://ift.tt/1ngDoom


http://ift.tt/Y3WWGG


If you have any question, please feel free to ask.


Best Regards,

Simon Hou


App Settings for Universal Apps


Brilliant.


I couldn't find the definition for windows store apps so I went with:



// App specific namespaces initialized
#if WINDOWS_PHONE_APP
//none
#else
using Windows.UI.ApplicationSettings;
#endif



This allowed me to declare the namespace no problem and the app is now running. Thanks for your extremely timely help.



If you're still reading this: How did you get the Windows Phone version to compile? Even if I move the using and the method that creates the SettingsFlyout into the #else block, the Windows Phone version still won't compile because it doesnt know the namespace Windows. UI.ApplicationSettings. The Windows 8.1 version runs finde however.


I solved the problem by moving App.xaml out of the shard folder. With tho App.xamls it compiles fine. Any downsides to this? I didn't notice any.


Looping is very slow on large data set

Please try this:



CREATE TABLE #Final ( RwNum INT PRIMARY KEY, JobSource NVARCHAR(100) , RuleName NVARCHAR(100) ,PackageType NVARCHAR(100) )
INSERT #Final
( RwNum ,
JobSource ,
RuleName ,
PackageType
)
VALUES ( 1 , N'Presubmission' , N'GameRating' , N'Xap' ), ( 2 , N'PostSubmission' , N'GameRating' , N'Xap' ), ( 3 , N'Presubmission' , N'GameRating' , NULL ),
( 4 , N'Presubmission' , N'TCRRule' , N'Xap' ), ( 5 , N'PostSubmission' , NULL , N'Xap' ), ( 6 , N'Submission' , NULL , N'Xap' ) ;


SELECT *
FROM #Final a

SELECT a.RwNum AS aId, b.RwNum AS bId
FROM #Final a
JOIN #Final b
ON ( a.JobSource = b.JobSource AND a.RuleName = b.RuleName )
OR ( a.JobSource = b.JobSource AND a.PackageType = b.PackageType AND a.RuleName IS NULL )
WHERE a.RwNum <> b.RwNum



SELECT *
FROM #Final AS f
WHERE NOT EXISTS
( SELECT *
FROM #Final AS a
JOIN #Final AS b
ON ( a.JobSource = b.JobSource AND a.RuleName = b.RuleName )
OR ( a.JobSource = b.JobSource AND a.PackageType = b.PackageType AND a.RuleName IS NULL )
WHERE a.RwNum <> b.RwNum
AND f.RwNum = IIF(a.RwNum > b.RwNum, a.RwNum , b.RwNum) )





Saeid Hasani [sqldevelop]


Looping is very slow on large data set

You can simply delete not wanted RwNum(s).



DELETE
FROM #Final
WHERE RwNum IN (
SELECT IIF(a.RwNum > b.RwNum, a.RwNum , b.RwNum)
FROM #Final a
JOIN #Final b
ON ( a.JobSource = b.JobSource AND a.RuleName = b.RuleName )
OR ( a.JobSource = b.JobSource AND a.PackageType = b.PackageType AND a.RuleName IS NULL )
WHERE a.RwNum <> b.RwNum
)





Saeid Hasani [sqldevelop]


Looping is very slow on large data set

Using your example data (thanks!) I put this together.


It should show you the pairings:



SELECT t.RwNum, t.JobParentID, t.JobSource, t.PackageType, t.UpdateType, t.IsAutoPassed, t.IsCanceled, t.IsSkipped, t.Result, t.Fired, t.RuleName, t2.*
FROM @Tab t
LEFT OUTER JOIN @tab t2
ON t.jobParentID = t2.JobParentID
AND t.RwNum <> t2.RwNum
AND (t.JobSource = t2.JobSource OR (NULLIF(t.JobSource ,'') IS NULL AND NULLIF(t2.JobSource ,'') IS NOT NULL) OR (NULLIF(t2.JobSource ,'') IS NULL AND NULLIF(t.JobSource ,'') IS NOT NULL))
AND (t.PackageType = t2.PackageType OR (NULLIF(t.PackageType ,'') IS NULL AND NULLIF(t2.PackageType ,'') IS NOT NULL) OR (NULLIF(t2.PackageType ,'') IS NULL AND NULLIF(t.PackageType ,'') IS NOT NULL))
AND (t.UpdateType = t2.UpdateType OR (NULLIF(t.UpdateType ,'') IS NULL AND NULLIF(t2.UpdateType ,'') IS NOT NULL) OR (NULLIF(t2.UpdateType ,'') IS NULL AND NULLIF(t.UpdateType ,'') IS NOT NULL))
AND (t.IsAutoPassed = t2.IsAutoPassed OR (NULLIF(t.IsAutoPassed ,'') IS NULL AND NULLIF(t2.IsAutoPassed ,'') IS NOT NULL) OR (NULLIF(t2.IsAutoPassed ,'') IS NULL AND NULLIF(t.IsAutoPassed ,'') IS NOT NULL))
AND (t.IsCanceled = t2.IsCanceled OR (NULLIF(t.IsCanceled ,'') IS NULL AND NULLIF(t2.IsCanceled ,'') IS NOT NULL) OR (NULLIF(t2.IsCanceled ,'') IS NULL AND NULLIF(t.IsCanceled ,'') IS NOT NULL))
AND (t.IsSkipped = t2.IsSkipped OR (NULLIF(t.IsSkipped ,'') IS NULL AND NULLIF(t2.IsSkipped ,'') IS NOT NULL) OR (NULLIF(t2.IsSkipped ,'') IS NULL AND NULLIF(t.IsSkipped ,'') IS NOT NULL))
AND (t.result = t2.Result OR (NULLIF(t.Result ,'') IS NULL AND NULLIF(t2.Result ,'') IS NOT NULL) OR (NULLIF(t2.Result ,'') IS NULL AND NULLIF(t.Result ,'') IS NOT NULL))
AND (t.Fired = t2.Fired OR (NULLIF(t.Fired ,'') IS NULL AND NULLIF(t2.Fired ,'') IS NOT NULL) OR (NULLIF(t2.Fired ,'') IS NULL AND NULLIF(t.Fired ,'') IS NOT NULL))
AND (t.RuleName = t2.RuleName OR (NULLIF(t.RuleName ,'') IS NULL AND NULLIF(t2.RuleName ,'') IS NOT NULL) OR (NULLIF(t2.RuleName ,'') IS NULL AND NULLIF(t.RuleName ,'') IS NOT NULL))
ORDER BY 2 DESC ,1 ASC


Looping is very slow on large data set

Well, yes, because I wanted you to be able to evaluate the result set.


I kinda figured you would be able to modify it after establishing it's doing what's needed.


Looping is very slow on large data set

Question: Can there ever be more than two rows you have to merge in a single data set?


I have a simplified example. You will have to forgive me for not using your exact table structure for this example. I just wanted something simple to illustrate the concept.


you should be able to adapt this approach to your solution.








set ansi_warnings off

set nocount on



declare @t as table (

JobKey int not null

,colA char(1)

,colB char(1)

,colC char(1)

)



--these will merge
insert into @t values (1,'a' ,'' ,null)

insert into @t values (1,'a' ,null,'c' )

insert into @t values (1,' ' ,'b' ,null)



--these will NOT merge (i suppose you could argue that the 1st two could be merged)
insert into @t values (2,'x' ,null,null)

insert into @t values (2,'x' ,null,'z' )

insert into @t values (2,'w' ,'y' ,'K' )



--these will merge
insert into @t values (3,'c' ,'' ,' ' )

insert into @t values (3,'c' ,'d' ,' ' )

insert into @t values (3,'c' ,null,'e' )





--first, let's get replaces the spaces with null
update @t

set colA=case when LEN (ltrim (rtrim (colA))) > 0 then colA end

,colB=case when LEN (ltrim (rtrim (colB))) > 0 then colB end

,colC=case when LEN (ltrim (rtrim (colC))) > 0 then colC end

;

with cteClean(JobKey, colA, colB, colC)

AS

(

select JobKey,MIN(colA),MIN(colB),MIN(colC)

from @t

group by JobKey

having COUNT(distinct(colA))=1

and COUNT(distinct(colB))=1

and COUNT(distinct(colC))=1

)

select * from cteClean

union

select * from @t t where t.JobKey not in (select c.jobkey from cteClean c)

;






Send email including the data field into the html message body

Thank you a lot..


That worked.


Saturday, August 30, 2014

Send email including the data field into the html message body

Hi,


When I run the stored procedure I get the following message for ' + @date + '


Incorrect syntax near '+'.


Trying to Sum() values from a nvarchar field and sort out scrap data

Also tried in query



SUM(CAST(info145 AS float)) AS info145,



Systemdeveloper @ 4film


Help with an error

Incidentally, for displaying text on the console it's not necessary to explicitly use the "Out" property:



Console.WriteLine("You entered: " + family); // OK



- Wayne

Snapping the game during the pre-ad loading screen - Event 1002 application hang (Task category 101)

Snapping the game during the pre-ad loading screen.


Event 1002 application hang (Task category 101)


How to fix it?


Trying to Sum() values from a nvarchar field and sort out scrap data

Tried this aswell



=Sum(IIF(ISNOTHING(Fields!info145.Value), 0,Cdbl(Fields!info145.Value)))





Systemdeveloper @ 4film


help me under stand the key word "new" in c#

hey guys


I can't understand how to use the "new" key word in c#


please explain me in detail that, thank you


If I just said something wrong, forgive me, my English is very bad


for example



int[] numbers = new int[];

or


using System.IO
StreamReader myreader = new StreamReader("Values.txt");

or

etc
class Program
{
static void Main(string[] args)
{
car mynewcar = new car();
}
}
class car
{
public string etc
public int etc
}



ps: explain me just about the word "new", how and when we use it, I have been crazy about that word :)


thanks


Marshalling an Array of struct from DispInterface C++ COM to a C# Client

Hello Peter,


1. The return value from the method of the COM server, the VARIANT, translates to a C# object.


2. Now this object contains an array of objects (this is so since the return VARIANT is a SAFEARRAY of DispInterfaces).


3. What you have to do is to convert each of these array object element into the appropriate class (defined in the relevant interop assembly).


4. The following is an example :



static void DoTest()
{
// Suppose that the class which returns the VARIANT is
// called ArrayContainerClass.
ArrayContainerClass container = new ArrayContainerClass();

// Get it to return the SAFEARRAY of DispInterfaces.
// This SAFEARRAY is contained in a VARIANT and is
// represented as an object in C#.
object obj = container.GetArrayOfElements();

// Each array element is itself an object.
object[] obj_array = (object[])obj;

// Create an array of the elements of the array.
// Let's say each element is of type ArrayElementClass.
ArrayElementClass[] element_array = new ArrayElementClass[obj_array.Length];

// Convert each object element in obj_array into an ArrayElementClass instance.
for (int i = 0; i < obj_array.Length; i++)
{
element_array[i] = (ArrayElementClass)(Marshal.CreateWrapperOfType(obj_array[i], typeof(ArrayElementClass)));
}
}



- Bio.





Please visit my blog : http://ift.tt/1r6KxsJ


Shared Dataset for SSRS - Data Defaults

/thanks for the reply, but the code sample you included does not give me what I'm looking for...


I don't need to know the week number or whether or not a day is a weekday or weekend. I am looking for the same construct as you would find in SSAS - a date that gives the beginning of the week. Every week start on a Sunday.


I am trying to do the same thing in SQL Server, and again, from what I have seen the only two built in functions for SQL Server for getting anything similar is MONTH or YEAR.


I also am not hardcoding dates. As you can see in the code example I posted, I am taking the current date, NOT hard coded dates.




A. M. Robinson


Marshalling an Array of struct from DispInterface C++ COM to a C# Client

Hello Peter,


1. You mentioned in the OP that the returned VARIANT contains a SAFEARRAY of DispInterfaces, hence I expected that the MatchedItem structure would be wrapped inside a class that implements the dispinterface.


2. Hence the answer to the question in your last post is : no.


3. Although you can create a SAFEARRAY that contains structures (provided that it is defined with a GUID in the IDL), it cannot be marshaled successfully to .NET if the array is to be contained in a VARIANT.


4. My suggestion is to create a C++ class that implements dispinterface and use it to represent the MatchedItem structure.


- Bio.




Please visit my blog : http://ift.tt/1r6KxsJ


Shared Dataset for SSRS - Data Defaults

Hi Robinson,


Try this.




sathya - http://ift.tt/K0aCLw ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.


IEnumerable Syntactic Sugar Proposal

What I really want to know is, what is the difference between:

public static IEnumerable<int> GetNumber()
{
return _numbers.Select(x => x);
}

and



public static IEnumerable<int> GetNumber()
{
return _numbers;
}


In the first example you return the items lazily whereas in the second you just return the array as is with an implicit cast to IEnumerable<int>.



Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.


Shared Dataset for SSRS - Data Defaults

I have a shared dataset in an SSRS reporting project that is used to create some date defaults to use as parameters in reports. Here is the query:



SELECT 'Calendar ' + CONVERT(varchar(4), YEAR(CurrentDate)) AS CurrentCalendarYear,
'[Time].[Year - Month].[Year].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-01-01T00:00:00]' AS CurrentCalendarYearMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Year].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-01-01T00:00:00]' AS CurrentCalendarYearExMDX,
CAST(DATENAME(month, CurrentDate) AS varchar(10)) + ' ' + CONVERT(varchar(4), YEAR(CurrentDate)) AS CurrentMonth,
'[Time].[Year - Month].[Month].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(CurrentDate)), 2) + '-01T00:00:00]' AS CurrentMonthMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Month].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(CurrentDate)), 2) + '-01T00:00:00]' AS CurrentMonthExMDX,
'Calendar ' + CAST(YEAR(LastMonth) AS varchar(5)) AS PreviousMonthCalendarYear,
'[Time].[Year - Month].[Year].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-01-01T00:00:00]' AS PreviousMonthCalendarYearMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Year].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-01-01T00:00:00]' AS PreviousMonthCalendarYearExMDX,
CAST(DATENAME(month, LastMonth) AS varchar(10)) + ' ' + CAST(YEAR(LastMonth) AS varchar(5)) AS PreviousMonth,
'[Time].[Year - Month].[Month].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(LastMonth)), 2) + '-01T00:00:00]' AS PreviousMonthMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Month].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(LastMonth)), 2) + '-01T00:00:00]' AS PreviousMonthExMDX
FROM (SELECT GETDATE() AS CurrentDate, DATEADD(month, - 1, GETDATE()) AS LastMonth) AS d

What I'd also like to do is update the query to return the current week and the previous week. AS far as I can tell, there is no function in T-SQL to return week - it apparently takes some formatting.


If someone could provide some insight in to how to make this work, it would be greatly appreciated. It needs to be in the format of 27-July-2014.


Thanks!




A. M. Robinson


Shared Dataset for SSRS - Data Defaults

By "Week", I mean what week of the month it is, as I provided in my example.


The week of August 3rd, the week of August 10th, etc. This is a concept that can be found in MDX and Analysis Services. It's a pretty standard thing. I have not found anything similar to this construct that is native to T-SQL. I cannot do something similar in T-SQL.


What I don't need is just the number of the week in the year. Again, I've found nothing similar in T-SQL. I've only seen Month and Year functions.


This is what MDX returns with regards to Week:





A. M. Robinson


Shared Dataset for SSRS - Data Defaults

Hi Robinson,


Try this.




sathya - http://ift.tt/K0aCLw ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.


Marshalling an Array of struct from DispInterface C++ COM to a C# Client

Hello Peter,


1. >> Yes I already did this. The MatchedItem struct has the same name as this DispInterface and describes the structure of this DispInterface.


1.1 Yes, in this case, if MatchedItem is actually a COM class that implements dispinterface, then the sample code you provided showing MatchedItem in use would be correct.


2. Just to be sure, the ArrayElement class defined in my test code is represented as follows in my IDL :



[ uuid(1064CDA0-7AAB-4F9D-8094-DD638F944DB3) ]
dispinterface IArrayElement
{
properties:
[id(1), helpstring("property IntProperty01")] LONG IntProperty01;
[id(2), helpstring("property IntProperty02")] LONG IntProperty02;
[id(3), helpstring("property IntProperty02")] LONG IntProperty03;
methods:
};

// Class information for ArrayElement

[ uuid(599BF2F0-955A-40CF-83C1-B8A55F4A675F) ]
coclass ArrayElement
{
[default] dispinterface IArrayElement;
};

- Bio.



Please visit my blog : http://ift.tt/1r6KxsJ


Connect Asp.net to winforms databse

Hey.I have a windows form application.This application uses a mssql database to store information.I created a website, but now I nid the website and my application to use the same database.


How can I achieve that?


How to get the user-agent with C#?

Hi All,


I have a question about how to get the client user-agent with C#? I have tried the code flowering,but it does not work.


HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

string agent = request.UserAgent;


Any suggestions?


Thanks,


Leslu


How to get the user-agent with C#?

Web api?


It's stored in the webheadercollection.


You could try:



if (Request.Headers.Contains("User-Agent"))
{
var headers = request.Headers.GetValues("User-Agent");

StringBuilder sb = new StringBuilder();

foreach (var header in headers)
{
sb.Append(header);

// Re-add spaces stripped when user agent string was split up.
sb.Append(" ");
}

userAgent = sb.ToString().Trim();
}





Hope that helps

Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


remove errors in the logfile

Read the entire file into a string, modify the string, write string back to file



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string file = File.ReadAllText("filename");
//make changes
File.WriteAllText("filename",file);
}
}
}





jdweng


How can I use await ?

Hi,


You can find the project at

http://ift.tt/VQTihH


When I change categories I have sometime especialy when I select

Presidents


ContextSwitchDeadlock occurred

Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Users\ADRIAN\Documents\Visual Studio 2013\Projects\Words Gen\Words Gen\bin\x86\Debug\AppX\Words Gen.exe'.

Additional information: The CLR has been unable to transition from COM context 0x15499b0 to COM context 0x1549a68 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

Thanks




ADRIAN DIBU


How can I use await ?

Hi,


Please can somebody to explain the error


ContextSwitchDeadlock occurred.


It means the table is accessed while is in used, and how can I prevented.


Best regards




ADRIAN DIBU


Query to retrieve parent-child aggregate records

thank you very much this helped me

Shared Dataset for SSRS - Data Defaults

By "Week", I mean what week of the month it is, as I provided in my example.


The week of August 3rd, the week of August 10th, etc. This is a concept that can be found in MDX and Analysis Services. It's a pretty standard thing. I have not found anything similar to this construct that is native to T-SQL. I cannot do something similar in T-SQL.


What I don't need is just the number of the week in the year. Again, I've found nothing similar in T-SQL. I've only seen Month and Year functions.


This is what MDX returns with regards to Week:





A. M. Robinson


Query to retrieve parent-child aggregate records




Please help me with a query in oracle database for the given scenario , this is very urgent any help is appreciated


For a given product with a codevalue 123 with 2 ingredients AA with weight 10gm and BB with weight 15gm , i need concatination value of codevalue+ingredient1+weight1+ingredient2+weight2 for a given product i.e 123AA10GMBB15GM.


so the final output should be codevalue+ingredient1+weight1+ingredient2+weight2+ingre3+weight3+.....


thanks




Query to retrieve parent-child aggregate records

Try a cursor that loops through the ingredients, and concatenate the attributes to a varchar(max) string.


Bodo Michael Danitz - MCT, MCITP - free consultant - performance specialist - www.sql-server.de


IEnumerable Syntactic Sugar Proposal

Hello,


There's no real need, you can just use LINQ to do it.



public static IEnumerable<int> GetNumber1()
{
return _numbers.Select(x => x);
}




public static IEnumerable<int> GetNumber2()
{
return from number in _numbers select number;
}



*
Bear in mind that this is equivalent in laziness but not in how it's implemented under the hood!




Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.




IEnumerable Syntactic Sugar Proposal

Wyck, can you explain this in a bit more detail to me?


You are doing a foreach on SomethingElse(someArguments)


and then immediately yield returning the items


Doesn't that mean SomethingElse is already an IEnumerable of T ?


Why do you need Foo() at all?


Selecting records between two dates nothing show although it have records in database why

Be careful with your query: you are writing <=@StartDate when it should be >=@StartDate.


Also, keep in mind another peculiarity when you pass the parameters from C#: The hours, minutes and seconds get appended to the date, contrary to what happens when you test it in query analyzer. This might exclude from the results a row that would otherwise match the bounds of your search.


Selecting records between two dates nothing show although it have records in database why

Thank you for reply


No error come when i write these two statment in query analyser


it working


but also textbox in interface is converted to datetime


remove errors in the logfile

i have to remove the errors inside the logfile using c#.


Blitz


Shared Dataset for SSRS - Data Defaults

I have a shared dataset in an SSRS reporting project that is used to create some date defaults to use as parameters in reports. Here is the query:



SELECT 'Calendar ' + CONVERT(varchar(4), YEAR(CurrentDate)) AS CurrentCalendarYear,
'[Time].[Year - Month].[Year].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-01-01T00:00:00]' AS CurrentCalendarYearMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Year].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-01-01T00:00:00]' AS CurrentCalendarYearExMDX,
CAST(DATENAME(month, CurrentDate) AS varchar(10)) + ' ' + CONVERT(varchar(4), YEAR(CurrentDate)) AS CurrentMonth,
'[Time].[Year - Month].[Month].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(CurrentDate)), 2) + '-01T00:00:00]' AS CurrentMonthMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Month].&[' + CONVERT(varchar(4), YEAR(CurrentDate)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(CurrentDate)), 2) + '-01T00:00:00]' AS CurrentMonthExMDX,
'Calendar ' + CAST(YEAR(LastMonth) AS varchar(5)) AS PreviousMonthCalendarYear,
'[Time].[Year - Month].[Year].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-01-01T00:00:00]' AS PreviousMonthCalendarYearMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Year].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-01-01T00:00:00]' AS PreviousMonthCalendarYearExMDX,
CAST(DATENAME(month, LastMonth) AS varchar(10)) + ' ' + CAST(YEAR(LastMonth) AS varchar(5)) AS PreviousMonth,
'[Time].[Year - Month].[Month].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(LastMonth)), 2) + '-01T00:00:00]' AS PreviousMonthMDX,
'[Time].[Year - Half Year - Quarter - Month - Date].[Month].&[' + CONVERT(varchar(4), YEAR(LastMonth)) + '-' + RIGHT('0' + CONVERT(varchar(2), MONTH(LastMonth)), 2) + '-01T00:00:00]' AS PreviousMonthExMDX
FROM (SELECT GETDATE() AS CurrentDate, DATEADD(month, - 1, GETDATE()) AS LastMonth) AS d

What I'd also like to do is update the query to return the current week and the previous week. AS far as I can tell, there is no function in T-SQL to return week - it apparently takes some formatting.


If someone could provide some insight in to how to make this work, it would be greatly appreciated. It needs to be in the format of 27-July-2014.


Thanks!




A. M. Robinson


How to use FindName to find specific button?

Thanks a lot. This made my day :-)



Regards, Sigurd F


SQLite in windows 8.1

SQLite does work in general for Windows Store apps.


See SQLite for a rundown of how to install and access the right version.


If you're still having problems then there may be something unusual in your environment. We'll need more information about the specific package you're using and the specific error that you're getting.


For offline sync with Azure Mobile Services take a look at http://ift.tt/1qu6B4u .


--Rob


SSRS 2008 R2 report does not print the page header for a html content displaying on multiple pages

When you say page header do you mean page header section of rdl or you just add another tablix within report body itself to make it header?


Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


how to connect two different windows form application in c#

I've deleted the irrelevant posts here and I'm locking the thread.


@OP, you can create a new thread and continue to discuss your issues there.




Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.


Visual Studio Express 2013 downloaded, but install window will not launch.

Hi I just downloaded Visual Studio Express 2013, and when I attempted to launch the file to install the logo of Visual Studio appeared, and then nothing happened. There was no install window I checked to make sure my windows 7 operating system was updated, I checked task manager to see if it was running in the background, I tried to download it again. If anyone knows what the issue is it would be greatly appreciated.

Visual Studio Express 2013 downloaded, but install window will not launch.

The below forum is where you should post.


http://ift.tt/1h0fm0T


i want to create a media player.bt the following doesn't work.I need help...






how to connect two different windows form application in c#

Hi i am new to c# i am making hospital database management system.i am working on four different department laboratory,pharmacy etc


what i want is to connect two different window form application.For example on my reception department which is window form application 1 i want to call the forms of window form application 2 on window form application 1.How can i do this


plx help as soon as possible.


how to connect two different windows form application in c#

You need to use an instance of a form like in the coded below


Form 1



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Form2 form2;
public Form1()
{
InitializeComponent();
form2 = new Form2(this);
}

private void button1_Click(object sender, EventArgs e)
{
form2.Show();
string results = form2.GetData();
}
}
}

Form 2



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
Form1 form1;
public Form2(Form1 nform1)
{
InitializeComponent();

this.FormClosing += new FormClosingEventHandler(Form2_FormClosing);
form1 = nform1;
form1.Hide();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
//stops for from closing
e.Cancel = true;
this.Hide();
}
public string GetData()
{
return "The quick brown fox jumped over the lazy dog";
}

}
}





jdweng


how to connect two different windows form application in c#

When you say call.


You mean show?


I suggest yor best approach would be to re-factor and move eveything into the one solution.


You can have multiple projects in the one solution.




Hope that helps

Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


how to connect two different windows form application in c#

For your kind information Mr.darnold924 as i mentioned above i am new to this and i am an undergraduate student .so, its obvious that i don't have that kind of expertise in programming as my studies don't include programming stuff i am from electrical side.


If you don't have the expertise, then you have no bussiness trying to do what you are doing on your own. You need to get someone to guide you, like I had someone, a mentor, guide me over 35 years ago when I landed my first programming job. I beat a path to her desk the first 6 months.


how to connect two different windows form application in c#

@OP, you need to elaborate farther and in the best of your ability to express the problem to get a serious response.


So far I can't even understand what you're trying to do? so let me ask you several questions.


a) Do you have two complete separated applications where each application lives in its own process? to make it simple and less technical do you have two .exe files, one for each application? and you want them to communicate or exchange information?


b) Do you have two forms that live in the same application and you want them to communicate? again, to make it simple do you have a single .exe file and two forms?


P.S. You can ask as many questions as you would like and we will do our best to help you but to make it happen you can't write few sentences and expect us to figure all the details by ourselves, you need to make things crystal clear.


I agree with darnold924 to some extent, I'd say let the people that its their area of expertise deal with it unless you want to learn software engineering or something of the sort.




Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.


how to connect two different windows form application in c#

@darnold924 I'd phrase things a bit differently and although I agree with you specifically on the lack of expertise I don't think we need to discourage him or start worry about the quality of the application, it's not our place to worry about it.




Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.


Friday, August 29, 2014

August T-SQL Guru - Festival of the Awesome T-SQL

No articles yet! 2 days to go!


Ed Price, Azure & Power BI Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)



Answer an interesting question? Create a wiki article about it!


adding script to specific page by using Location="ScriptLink" in solution

hello everybody


while extending the ribbon there is an option where the new element will be placed:



CommandUIDefinition Location="...

i am using the following code to inject my js functions, where the option to define the scope is missing (i want to load the code just at the pages where the button is available):



<CustomAction Id="ProjectCenterPage.AdditionalScript"
Location="ScriptLink"
ScriptSrc="~SiteCollection/SiteCollectionDocuments/PDPScheduleExtension.js"/>

i do not want to use any additional web parts on the page to perform the injection (like content editor) as far as additional web parts on the project schedule page breaks some functions like sizing (and leads to some more nasty bugs actually).


so is there a way to define the scope where the sript is loaded?


may be there are some other options to inject js code to a page?




Sergey Vdovin


adding script to specific page by using Location="ScriptLink" in solution

Hi,


Please try to use ScriptBlock attribute to add custom javascript:



<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://ift.tt/TQ1shZ;
<CustomAction
Location="ScriptLink"
ScriptBlock="
document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;~site/SiteCollectionDocuments/PDPScheduleExtension.js&quot;&gt;&lt;/' + 'script&gt;');"
Sequence="100" />
</Elements>

More information:


http://ift.tt/1mWxVTp


Thanks,

Dennis Guo

TechNet Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.




Dennis Guo

TechNet Community Support



adding script to specific page by using Location="ScriptLink" in solution

Thank you, Dennis - was thinking about this variant rigth now, but was not sure it is a recommended way.


If to include the url check before code loading it may work.




Sergey Vdovin


adding script to specific page by using Location="ScriptLink" in solution

Ended up with the following (works well, thanks again):



<CustomAction Id="ProjectCenterPage.AdditionalScript"
Location="ScriptLink"
ScriptSrc="~SiteCollection/SiteCollectionDocuments/PDPScheduleExtensionLoader.js"/>

PDPScheduleExtensionLoader.js



String.prototype.endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};

var siteUrl = "";
if (window.location.pathname.toLowerCase().endsWith('schedule.aspx')) {
siteUrl = window.location.href.toLowerCase().substring(0, window.location.href.indexOf("/project%20detail%20pages/schedule.aspx"));
document.write('<link rel="stylesheet" href="' + siteUrl + '/SiteCollectionDocuments/jquery-ui.css">');
document.write('<script type="text/javascript" src="' + siteUrl + '/SiteCollectionDocuments/datajs-1.1.1.min.js"></script>');
document.write('<script type="text/javascript" src="' + siteUrl + '/SiteCollectionDocuments/jquery-1.10.2.min.js"></script>');
document.write('<script type="text/javascript" src="' + siteUrl + '/SiteCollectionDocuments/jquery-ui.js"></script>');
document.write('<script type="text/javascript" src="' + siteUrl + '/SiteCollectionDocuments/Local.js"></script>');
document.write('<script type="text/javascript" src="' + siteUrl + '/SiteCollectionDocuments/Utils.js"></script>');
document.write('<script type="text/javascript" src="' + siteUrl + '/SiteCollectionDocuments/PDPScheduleExtension.js"></script>');
}





Sergey Vdovin


Steps for Migration from SharePoint 2007 to SharePoint 2010?

Hi All,


Can any one tell the steps for migration from SharePoint 2007 to SharePoint 2010.


Thanks in advance!


Steps for Migration from SharePoint 2007 to SharePoint 2010?

This is the official communication:


http://ift.tt/1qc6ZUp


and this is a step by step guide:


Step by Step inplace upgrade to SP2010


Hope it helps!




Thanks, Ransher Singh, MCP, MCTS | Click Vote As Helpful if you think that post is helpful in responding your question click Mark As Answer, if you think that this is your answer for your question.


SharePoint beginner question

Hello roxannaappleby,



Geramelnte works with different environments. Thus we have:

Production environment.

Approval environment.

Development environment.



The solutions are developed within the development environment, done that they are installed in the environment of approval for tests and the like, after being approved solutions are installed in the production environment.



I hope I have answered your questions.



Hugs

Adding a Dollar $ to calculation from a CASE statement

Celko:


It was rude ("is a design flaw called tibbling and we laugh at you for doing it").


But I appreciate your bullet points and have made changes, and of course I want the assistance (and also gain knowledge). Otherwise; why post a question.


Your post was also helpful, thank you.


Regards,


jr7138




jer


what's the namespace for [datasource] for data driven test

I am adding data driven into my coded UI test. Based on some information online, I should use [DataSource...] before my test method. While, my VS complain don't know this. I was tried to add

Microsoft.VisualStudio.TestTools.UITesting.WinControls namespace, while it complains that WinControls is not under UITesting. How should I make it work?


what's the namespace for [datasource] for data driven test

The DataSource attribute is part of Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll and this assembly can only be referenced from Coded UI Test Projects that targets the .NET Framework (see http://ift.tt/1j2zYov) but not in a Unit Test Library for Windows Store Apps.


In other words, the DataSourceAttribute class is not available for Windows Store Apps.




Please refer to the following thread for more information: http://ift.tt/1n58fEc

how we can send sms with c# app. along attach mobile to system and sms send actually from mobile through application?


sms


Adding a Dollar $ to calculation from a CASE statement

Naomi,


Thanks for the message. I will work on formatting within the presentation layer.


Regards,


jr7138




jer


Adding a Dollar $ to calculation from a CASE statement

Patrick:


You answered a question, an end-user had without blow-back or preaching. That takes a high amount of skill.


Regards,


jr7138




jer


SignatureDescription class cannot be found when compiling

The SignatureDescription class is part of the .NET Framework and you can only use it in your back-end system (a web service or something similar) as the topic on MSDN suggests: http://ift.tt/1thTvZV.


You cannot use this class directly in your Windows Store App. The mentioned topic disusses how to validate a receipt in a service.


Enumerate nearby unpaired Bluetooth LE devices

Hi!


I'm currently developing and app that needs to find all nearby Bluetooth LE devices and show them to the user. The Bluetooth LE Devices have not been paired with the user's phone. Is it possible to do this? I've been trying with:



DeviceInformation.FindAllAsync

But no luck! I'm using a Windows Phone 8.1 Cyan device with Bluetooth LE support. The fibit app seems to be able to discover nearby unpaired wristbands.


Thanks!


Enumerate nearby unpaired Bluetooth LE devices

As far as I am aware, there is no way to find/pair with unpaired BT devices inside the app - you must pair with the device in the settings first.


Matt Small - Microsoft Escalation Engineer - Forum Moderator

If my reply answers your question, please mark this post as answered.



NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


Formatting

Ha, didn't even think of that, nice one Visakh

Play a sound when the application closes in C#


The first form you open has a special meaning - it's the mainwindow.


When you close that window the application closes.


In my windows forms application this is Form2.


I handle the FormClosing event on that window and it works OK for me:



private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"C:\Windows\Media\Alarm09.wav");

player.Play();
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
}





Hope that helps

Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.



EDIT: It worked it the end - it seemed that the code needed to be placed on the startup form!




---- JDS404 ---- Check out my blog at http://ift.tt/SaWROI!



Group By partial string

Give this concept a try:



DECLARE @forumTable TABLE (names VARCHAR(100))
INSERT INTO @forumTable (names)
VALUES
('Joe'),
('John;Robert;Doug'),
('Barry;Robert'),
('Doug'),
('Robert;Doug;Joe;John')
DECLARE @loopTable TABLE (names VARCHAR(100))
INSERT INTO @loopTable (names)
SELECT * FROM @forumTable

DECLARE @thisName VARCHAR(100)
DECLARE @names TABLE (name VARCHAR(100))
WHILE (SELECT COUNT(*) FROM @loopTable) > 0
BEGIN
SET @thisName = (SELECT TOP 1 names FROM @loopTable)
WHILE CHARINDEX(';', @thisName) > 0
BEGIN
IF NOT EXISTS (SELECT 'x' FROM @names WHERE name = LEFT(@thisName,CHARINDEX(';',@thisName)-1))
BEGIN
INSERT INTO @names (name) VALUES (LEFT(@thisName,CHARINDEX(';',@thisName)-1))
END
SET @thisName = RIGHT(@thisName,LEN(@thisName)-CHARINDEX(';',@thisName))
END
IF NOT EXISTS (SELECT 'x' FROM @names WHERE name = @thisName)
BEGIN
INSERT INTO @names (name) VALUES (@thisName)
END
DELETE FROM @loopTable WHERE names = (SELECT TOP 1 names FROM @loopTable)
END

SELECT name, COUNT(*)
FROM @names
INNER JOIN @forumTable
ON names LIKE '%'+name+'%'
GROUP BY name



You can, of course, use temp tables, or actual tables if you'd prefer. It's much easier to test (for me at least) using table variables.