Wednesday, December 31, 2014

Check month and day fields lies between two dates

Thanks for the quick reply Vaibhav. If the @StartDate is say 12/01/2014(MM/DD/YYYY) and EndDate is 02/28/2015, then I need to get the records(MM/DD) between these two dates. Can you kindly let me know as in above, you are considering for specific month of startdate only.

Check month and day fields lies between two dates

Hi Sarayu_CM,


If I understand correctly, you want to select month and day fields with this format (MM/DD) between two dates.


The following query is for your reference:



CREATE TABLE #T (
MyMonth INT
,Myday INT
)
INSERT #T
select 2,11 union
select 4,11 union
select 2, 15 union
select 1, 20
DECLARE @StartDate DATE,@EndDate DATE,@mymonthday date
SET @StartDate = '02/11/2012'
SET @EndDate = '02/28/2014'
declare @year int,@start int,@end int
set @year=0
set @start=year(@StartDate)
set @end=year(@EndDate)
;with cte as
(select mymonth, myday, @start as runningvalue
from #T
union all
select t.mymonth,t.myday,c.runningvalue+1
from cte c
inner join #T t on c.MyMonth=t.MyMonth
where c.runningvalue+1<=@end)
select
distinct (case
when Mymonth>=10
then cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
when MyMonth<10
then '0'+cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
end) mymonthday from cte
WHERE cast(((case
when Mymonth>=10
then cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
when MyMonth<10
then '0'+cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
end)+'/'+cast(runningvalue as varchar(4))) as date) between @StartDate and @EndDate



Thanks,

Katherine Xiong




Katherine Xiong

TechNet Community Support



Issue while applying validation to SharePoint Date Time Control

try these links:


http://ift.tt/1I194I0


i think you have used conversion which is not possible for date type so use spuility as SPUtility.CreateISO8601DateTimeFromSystemDateTime


Issue while applying validation to SharePoint Date Time Control

Hi Naga,


According to your post, you might want to use CompareValidator control to validate the SharePoint DateTime control.


The SharePoint DateTime control seems not work so well with the CompareValidator control.


As a workaround, you can implement the validation with an extra Label control like this:



<!--in the page-->

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<SharePoint:DateTimeControl runat="server" Calendar="Gregorian" DateOnly="true" ID="ToDate" AutoPostBack="true" OnDateChanged="ToDate_OnDateChanged" />
<asp:Label ID="Label1" runat="server" Text="Label">date validation test</asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ToDate" EventName="DateChanged" />
</Triggers>
</asp:UpdatePanel>



//in code behind

protected void ToDate_OnDateChanged(object sender, EventArgs e)
{
if (ToDate != null)
{
Label1.Text += "<p/>" + ToDate.SelectedDate.ToShortDateString();
DateTime t1 = DateTime.Today;
DateTime t2 = ToDate.SelectedDate;
int i = DateTime.Compare(t1,t2);
if (i < 0)
{
//t1<t2
Label1.Text += " later than today";
}
if (i == 0)
{
//t1==t2
Label1.Text += " equal today";
}
if (i > 0)
{
//t1>t2
Label1.Text += " earlier than today";
}
}
}



It will work like this in a page:




Best regards




Patrick Liang

TechNet Community Support



Event loop based programming help in c#

Hello everyone . I was reading about node.js and how it does all the work using event loops using a single thread to do all the non-blocking socket I/O . I am trying to implement the same concept in my application which will be doing a lot of socket I/O including some disk I/O while I will do on a separate thread so that the application doesn't come to its knees . I am going to implement this mode in C# . I have looked around but the answers and solutions given are just too abstract and general . Can you please help me ?

I need to concatenate xml string and output shoul be in table using t-sql

Below is subquery method that separates the strings:



SELECT
bo.value('ID[1]', 'int') AS ID
, STUFF(
(SELECT ' ' + Detail.value('.', 'varchar(MAX)')
FROM Detail_List.nodes('Detail') AS Detail_List(Detail)
FOR XML PATH('')), 1, 1, '') AS DETAIL
FROM @x.nodes('/bo') AS xml(bo)
CROSS APPLY bo.nodes('./Detail_List') AS bo(Detail_List);





Dan Guzman, SQL Server MVP, http://www.dbdelta.com


I need to concatenate xml string and output shoul be in table using t-sql


DECLARE @x xml =
'<bo>
<ID>1</ID>
<DetailList>
<Detail>abc</Detail>
<Detail>def</Detail>
</DetailList>
</bo>
<bo>
<ID>2</ID>
<DetailList>
<Detail>bcd</Detail>
</DetailList>
</bo>'
SELECT t.u.value('ID[1]','int') AS ID,
t.u.query('data(DetailList/Detail)').value('.','varchar(max)') AS DetailList
FROM @x.nodes('/bo')t(u)





Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


Check month and day fields lies between two dates

Hi,


I have two fields which stores month and day separately. I have a requirement where I need to check the month and day fields(in the format MM/DD) should lie between two dates. For example, if I have month and day fields stored as (02/11), then if the user passes from and to dates as 02/11/2012(MM/DD/YYYY) to 02/28/2014, then I need get that record(02/11).


Kindly provide your inputs.


Check month and day fields lies between two dates

Something like below? if you have reocrds for month of Feb in 2013. That will also come in result here. Because you have no Year information



CREATE TABLE #T (
MyMonth INT
,Myday INT
)
INSERT #T
select 2,11 union
select 4,11 union
select 2, 15 union
select 1, 20
DECLARE @StartDate DATE
SET @StartDate = '02/11/2012'
DECLARE @EndDate DATE
SET @EndDate = '02/28/2012'
SELECT *
FROM #t
WHERE MyMonth = MONTH(@StartDate)
AND myday BETWEEN day(@StartDate) AND day(@EndDate)





-Vaibhav Chaudhari


Check month and day fields lies between two dates

Thanks for the quick reply Vaibhav. If the @StartDate is say 12/01/2014(MM/DD/YYYY) and EndDate is 02/28/2015, then I need to get the records(MM/DD) between these two dates. Can you kindly let me know as in above, you are considering for specific month of startdate only.

Check month and day fields lies between two dates

Hi Sarayu_CM,


If I understand correctly, you want to select month and day fields with this format (MM/DD) between two dates.


The following query is for your reference:



CREATE TABLE #T (
MyMonth INT
,Myday INT
)
INSERT #T
select 2,11 union
select 4,11 union
select 2, 15 union
select 1, 20
DECLARE @StartDate DATE,@EndDate DATE,@mymonthday date
SET @StartDate = '02/11/2012'
SET @EndDate = '02/28/2014'
declare @year int,@start int,@end int
set @year=0
set @start=year(@StartDate)
set @end=year(@EndDate)
;with cte as
(select mymonth, myday, @start as runningvalue
from #T
union all
select t.mymonth,t.myday,c.runningvalue+1
from cte c
inner join #T t on c.MyMonth=t.MyMonth
where c.runningvalue+1<=@end)
select
distinct (case
when Mymonth>=10
then cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
when MyMonth<10
then '0'+cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
end) mymonthday from cte
WHERE cast(((case
when Mymonth>=10
then cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
when MyMonth<10
then '0'+cast(mymonth as varchar(2))+'/'+cast(Myday as varchar(2))
end)+'/'+cast(runningvalue as varchar(4))) as date) between @StartDate and @EndDate



Thanks,

Katherine Xiong




Katherine Xiong

TechNet Community Support



Is there any performance advantage to awaiting Tasks in a BackgroundTask vs just calling WAIT?

If you just gather up all your tasks in the BackgroundTask and then call Task.WaitAll, is there any reason not to do this?


I'm mainly curious because of some mutex code that would just be simpler to use if I just Waited on the tasks instead of awaited them.




total average of a text box

Please refer the below link. A custom code can be used.


http://ift.tt/14e0adQ




Regards, RSingh


total average of a text box

Hi Anu,


Per my understanding that you have add an group "Branch_Name" in the report and you can using the expression "=Avg(Fields!YTD_Total_Premium.Value,"Branch_Name")" to calculate the average value for each group, now you want to get the total average value based on all the "Branch_Name", right?


I have tested on my local environment and it is easy to get the total avg by using the expression "Avg(Fields!YTD_Total_Premium.Value,"DataSetName")"


Details information below for your reference:



  1. Right click the Group "Branch_Name" under the row group and select the "Add Total" and click "After"


  2. Add or modify the expression to get the value of Total Average:

    Avg(Fields!YTD_Total_Premium.Value,"DataSetName"



If your problem still exists, please try to provide your report structrue and the sample data.


Any problem, please feel free to ask.


Regards

Vicky Liu


total average of a text box

You need to see at what level you're putting the total textbox.


If its at a grouping level use



=Avg(Fields!YTD_Total_Premium.Value,"Group Name")



If its the grand total level then use



=Avg(Fields!YTD_Total_Premium.Value,"Datasetname")





Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


Issue while applying validation to SharePoint Date Time Control

try these links:


http://ift.tt/1I194I0


i think you have used conversion which is not possible for date type so use spuility as SPUtility.CreateISO8601DateTimeFromSystemDateTime


Issue while applying validation to SharePoint Date Time Control

Hi Naga,


According to your post, you might want to use CompareValidator control to validate the SharePoint DateTime control.


The SharePoint DateTime control seems not work so well with the CompareValidator control.


As a workaround, you can implement the validation with an extra Label control like this:



<!--in the page-->

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<SharePoint:DateTimeControl runat="server" Calendar="Gregorian" DateOnly="true" ID="ToDate" AutoPostBack="true" OnDateChanged="ToDate_OnDateChanged" />
<asp:Label ID="Label1" runat="server" Text="Label">date validation test</asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ToDate" EventName="DateChanged" />
</Triggers>
</asp:UpdatePanel>



//in code behind

protected void ToDate_OnDateChanged(object sender, EventArgs e)
{
if (ToDate != null)
{
Label1.Text += "<p/>" + ToDate.SelectedDate.ToShortDateString();
DateTime t1 = DateTime.Today;
DateTime t2 = ToDate.SelectedDate;
int i = DateTime.Compare(t1,t2);
if (i < 0)
{
//t1<t2
Label1.Text += " later than today";
}
if (i == 0)
{
//t1==t2
Label1.Text += " equal today";
}
if (i > 0)
{
//t1>t2
Label1.Text += " earlier than today";
}
}
}



It will work like this in a page:




Best regards




Patrick Liang

TechNet Community Support



total average of a text box

Please refer the below link. A custom code can be used.


http://ift.tt/14e0adQ




Regards, RSingh


total average of a text box

Hi Anu,


Per my understanding that you have add an group "Branch_Name" in the report and you can using the expression "=Avg(Fields!YTD_Total_Premium.Value,"Branch_Name")" to calculate the average value for each group, now you want to get the total average value based on all the "Branch_Name", right?


I have tested on my local environment and it is easy to get the total avg by using the expression "Avg(Fields!YTD_Total_Premium.Value,"DataSetName")"


Details information below for your reference:



  1. Right click the Group "Branch_Name" under the row group and select the "Add Total" and click "After"


  2. Add or modify the expression to get the value of Total Average:

    Avg(Fields!YTD_Total_Premium.Value,"DataSetName"



If your problem still exists, please try to provide your report structrue and the sample data.


Any problem, please feel free to ask.


Regards

Vicky Liu


expressions in data table

Check this, I am wondering the sample is using round braces. Have a try.


http://ift.tt/1hg1Gxm


chanmm




chanmm


expressions in data table

Hi chamm,


Thanks for your reply..


I am new to this technology,


Can you guide me with a simple example.


Thanks in advance


Sathya


Automation of Sql Server error log

Yes i want to read that from sp_readerrorlog and moved into temp table from that i want to automate

Automation of Sql Server error log

Yes i want to read that from sp_readerrorlog and moved into temp table from that i want to automate


-- Command will create the temporary table in tempdb
CREATE TABLE [dbo].[#TmpErrorLog]
([LogDate] DATETIME NULL,
[ProcessInfo] VARCHAR(20) NULL,
[Text] VARCHAR(MAX) NULL ) ;

-- Command will insert the errorlog data into temporary table
INSERT INTO #TmpErrorLog ([LogDate], [ProcessInfo], [Text])
EXEC [master].[dbo].[xp_readerrorlog] 0 ;

-- retrieves the data from temporary table
SELECT * FROM #TmpErrorLog


http://ift.tt/1zywVKG



Regards, Pradyothana DP. Please Mark This As Answer if it solved your issue. Please Mark This As Helpful if it helps to solve your issue. ========================================================== http://ift.tt/1sEFSlq


Automation of Sql Server error log

Similar:




CREATE TABLE [dbo].[ERRLOG](
[LogDate] [datetime] NULL,
[ProcessInfo] [varchar](50) NULL,
[Text] [varchar](MAX) NULL
) ON [PRIMARY]

insert into errlog exec [sp_readerrorlog] 0
insert into errlog exec [sp_readerrorlog] 1
insert into errlog exec [sp_readerrorlog] 2





¯\_(ツ)_/¯



Automation of Sql Server error log

What exactly you are trying to achieve? Is there any procesing done on table after your dump errorlog to SQL table? Why not just keep moving older files to some safe location and recycle errorlog daily/some frequency?


Balmukund Lakhani

Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker

--------------------------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------------------------------------------------------------------

My Blog | Team Blog | @Twitter | Facebook

Author: SQL Server 2012 AlwaysOn - Paperback, Kindle


month parameter between

Hi Dhananjay Rele,


Per my understanding that you have two parameters "Start Date" and "End Date", when the "start date" is bigger then the "End Date", there will be no data in the report, right?


This is by design, gernerally the Start Date should not be bigger then the End date and if the user have select it bigger then the End Date, we can give an alert message to let him know and reselect the values.


Details information below for your reference about how to add this alert message to warn the user.



  1. Select the whole tablix and in the Tablix properties, add an expression in the No Row Message as below:



    Expression as below:

    =IIF(Parameters!StartDate.Value >Parameters!EndDate.Value,"StartDate can't be bigger then the End date, please select the correct values","No Record between the date range")

  2. Preview you will see result as below when you have select the wrong parameters:



If you still have any problem, please feel fre to ask.


Regards

Vicky Liu


Sensing a keyboard press in a forms app?

Do you like something like this



private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
this.Focus();
this.KeyPress += new KeyPressEventHandler(Form1_KeyPress);
}

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Space)
{
i += 1;
label1.Text = "Worked !";

if (i == 10)
{
button1.Enabled = true;
label1.Text = "Finished !";
}
}
}

----------------------------------------------


Hope above help !


Doanh


Where to use the try/catch block in a using to catch exceptions?

I have this code:



using(MyEntities dbContext = new MyEntities)
{
//myCode
}

Well, the using ensures that the unmanaged resources are free when the code inside the using is finished. But I would like to catch the exceptions, such concurrency exceptions or others that can be happend.


I am thinking of two options. The first one, put the using inside the try block:



try
{
using(....)
{
//my code
}
}
catch
{
throw;
}

The second solution, put the try catch inside the the using:



using(...)
{
try
{
//my code
}
catch
{
throw;
}
}

My doubt is about disposing dbContext. For example, if I get an exception such as null reference in my code, becuase I try to access to a null variable. Will the dbContext dipose in both cases? or in some of the cases will not?


Are there others options to catch exceptions and ensure the disposing of the dbContext?


Thank so much.


Text is not being displayed in sync on a label when looping through a list -- how to fix?


there appears to be a lag in the label.Text property



Call the Update() method for the Label control immediately after changing the text to force

it to redraw immediately:



lblStateID.Text = "State is " + stateID;
lblStateID.Update();

- Wayne


Sensing a keyboard press in a forms app?

In a windows form, I have a button. When that button is pressed, I want it to look for keyboard presses. When the spacebar is pressed 10 times, I want the button to do something. Is this at all possible?


In Calculus, 1+1=0.


Sensing a keyboard press in a forms app?

Put a counter, every time count to 10 fire the event and reset it. Key press you can capture it using the following code:


http://ift.tt/14dD0nQ


\x020 represents a space.


chanmm




chanmm


Sensing a keyboard press in a forms app?

That code helped but it didn't solve my original problem. When I click the button, the button gets disabled but then I want the button method to trigger another method such as the KeyPress method. However, in this method, I absolutely need to be able to get the app to watch for keyboard presses. I can't have the app sense for key presses in it's own method. Is this possible?


In Calculus, 1+1=0.


SQl Script Help

Arbi,




I update the requirement.


Here is the sample output



















Measure



Valid Client



Raw Score



Positive



*Functioning: Cd1,cd2,cd3



1



5



1






SQl Script Help

I am not able to make out anything of this. You have a table CSDAT, which appears to have the columns MeasureName, Question, Client Valied, Score, Positive and Responsecodes. And what do you want to do with them?


For this type of question, you help yourself enormously if you post:


1) CREATE TABLE statement for your table(s), preferrably simplified for the problem at the question.

2) INSERT statement with sample data.

3) The desired output given the sample data.

4) A short description of the business rules that explains why want that particular result.

5) Which version of SQL Server you are using.


It is possible that if I stare at your post for half an hour or so, I would get what you are looking for, but keep in mind that people who answer here, are spending their free time. So if you are only making a half-hearted attempt to explain your problem, you will only get half-hearted attempts to answer back.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Vitual keyboard shift key initailly pressed.

Are you wanting to use this ability in your own app or are you reporting a bug?


~ TechPerson32


Text Box validation Using C#

What UI framework are you using so we can route you to the correct forums.

Text Box validation Using C#

Thank You so much.

SQl Script Help

Arbi,




I update the requirement.


Here is the sample output



















Measure



Valid Client



Raw Score



Positive



*Functioning: Cd1,cd2,cd3



1



5



1






RuntimeReflectionExtensions.GetRuntimeProperties() Malfunction?

I can file a bug on this, but is this affecting your development in any way?



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.


Databinding and Page View

Josh - there's not enough information here to understand what you're seeing. Can you share code and screenshts with us?


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.


Print report directly from URL

i have SSRS report where i have prompt to enter to get data. once the data is populated i would like to print directly from the print option rather saving to pdf and print. My page settings format is setup to 9X11 size. with this i can save and print fine. But if i print directly to print on A-4 right most part is not printing and looks like i have to change settings in my report. How do we print this kind of report correctly on A-4 size paper. Any help much appreciated.

Generated Script fails when attempting to drop Foreign Key Constraint

First question is whether you were running it on the correct database. Did you select option script USE database to True. Otherwise it will not have USE DBName on top and so if you just open it in a query editor window and execute it it will try to execute it against the default db (or master) which may not be where you have created those tables and constraints originally.


Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


Generated Script fails when attempting to drop Foreign Key Constraint

Are you sure there are no Constraints on other tables which are causing your issue?


If a foreign key from table abc refences table def it will cause the drop to fail.


If your script is already attempting to drop such constraints, have you checked that they are dropping from the correct table (and not the table that would be the target of the drop)?


StorageFileQueryResult ContentsChanged event not firing on file moving away?

It seems that the page doesn’t mention the event will fire when the file move out of folder. http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.search.aspx. Can you post some code snippets or repro project to make your situation clear?


StorageFileQueryResult ContentsChanged event not firing on file moving away?

Hi Lee McPherson,


As I know, when you move a file out of a folder that means you are copying a file to the target folder. This reference http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.search.aspx shows “Apps can receive events that fire when a collection changes because files where created, modified, or deleted”.


Regards,




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


StorageFileQueryResult ContentsChanged event not firing on file moving away?

Hi Lee McPherson,


>> If moving a file into a monitored folder triggers an event because the file was "created" there, why wouldn't moving a file out of a monitored folder trigger an event due to "deleting" the file?


Based on my research, I found there were something misunderstanding about file movement. There were two scenarios about moving a file out of source folder to target folder. If the two folders were in same drive, system would cut and paste file to target folder, then the event would raise and app worked fine. But if the tow folder were in different drive, system would copy a new file to target folder, then the event would not raise and app did not work. Please check it on your side. We cannot change the second scenario, so I suggest try to work around.


In desktop application, I know there are several properties like “last access time”, I think we can try to use these properties to achieve your requirement. Just maintains an array of object in your app, store those time properties at a particular time, refresh them using a timer, then you can know the changes in the folders. See the code sample in http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileproperties.basicproperties.aspx.


Regards,




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


Pulishing using Microsoft Visual Web Developer 2010

I created a website using Microsoft Visual Web Developer 2010 in C# and when I debug everything works fine no errors and I can register new names & users and login correctly on the local server. When I publish it onto my Godaddy shared server it doesn't work. I have SQL installed on my shared server, I have ASPNET installed, I have the debug set to false on the webconfig and still having problems getting it to work. Can anyone help me figure out if my connections strings are the problem or why it works on local server but not my shared server?

Create List Item using SharePoint 2010 Workflow

Hi Soni, thanks for reply.


This solution for simular lists (even don't understand what's useful for), in my case, I have two different structured lists. Try to describe it, do not pay attention for syntax:



<Employee OnBoards>
<Field Name="Employee Name"></Field>
<Field Name="Employee Email"></Field>
<Field Name="Position"></Field>
<Field Name="Department"></Field>
...
</Employee OnBoards>

<Employee OnBoards Tasks>
<Field Name="Name">Lookup Column of Employee Name</Field>
<Field Name="Approver 1"></Field>
<Field Name="Approver 2"></Field>
<Field Name="Approver 3"></Field>
...
</Employee OnBoards Tasks>





Create List Item using SharePoint 2010 Workflow

Hi Azamat,


You can copy list from one list other by workflow in SP Designer.


Please refer to screen shot below






Specify your item and mention the destination list name


That's it.


Thanks,

Vivek

Please vote or mark your question answered, if my reply helps you

Cannot link my site to SP 2010, says it is not a SP site

Hi,


I am trying to link my site to SharePoint Designer 2010 however, I receive two error messages when entering the URL:


The first says "default.aspx is not a valid folder name."


The second says "Microsoft SharePoint Designer does not support editing non-SharePoint sites."


My site is hosted by SharePoint and I am curious to know how I can resolve this issue and connect my site to SPD.


Thank you!


Tuesday, December 30, 2014

disable http access to report server

You can implement it at firewall level for desired link.


Thanks,


Vivek Singh


Create List Item using SharePoint 2010 Workflow

Hi Soni, thanks for reply.


This solution for simular lists (even don't understand what's useful for), in my case, I have two different structured lists. Try to describe it, do not pay attention for syntax:



<Employee OnBoards>
<Field Name="Employee Name"></Field>
<Field Name="Employee Email"></Field>
<Field Name="Position"></Field>
<Field Name="Department"></Field>
...
</Employee OnBoards>

<Employee OnBoards Tasks>
<Field Name="Name">Lookup Column of Employee Name</Field>
<Field Name="Approver 1"></Field>
<Field Name="Approver 2"></Field>
<Field Name="Approver 3"></Field>
...
</Employee OnBoards Tasks>





SharePoint foundation not allowing attachments on customized forms

You mean to say the OOB attach file option is not working as expected?


Thanks, Ashish | Please mark a post helpful/answer if it is helpful or answer your query.


Data driven subscription failing - There is no data for the field at position 2

Check the SSRS executionlog, the parameter column will show the actual values that SSRS takes. If this doesn't give you an answer, delete and recreate the subscription

Data driven subscription failing - There is no data for the field at position 2

Thanks for the reply! I verified the parameters used by proc and it is intact. I dropped and recreated the subscriptions multiple times!

Data driven subscription failing - There is no data for the field at position 2

Hi SivaganeshK,


According to your description, you configured subscription for the report and it worked fine before. After you removed a parameter from the report, the report works fine in report manager, but the error message occurs consistently after the subscription executed successfully.


The error message is usually caused by a missing field in the dataset. It is defined in the dataset, but the query does not return it. It is OK if you don't use the field in your report. But if you do, then you'd get the error or the report fails if it's used in a group/sort/filter expression.


To address this issue, we can click Refresh Fields button or run the query in the dataset properties dialog box, then check whether the field is returned by the query in the fields list.

If the issue still persist in report designer, you can try to recreate the dataset to fix it.


Here is a relevant thread you can reference:

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1ae8a0f8-74ac-48de-94a2-64e06b9c46f8/the-data-extension-returned-an-error-during-reading-the-field-there-is-no-data-for-the-field-at?forum=sqlreportingservices


If you have any more questions, please feel free to ask.


Thanks,

Wendy Fu


FTP download question

put try catch block and see if the server is throwing some exception, i dont think the server is responding

QUery help

select convert(date,'19'+substring(cast('410201' as varchar),1,6)) as date

Preserving whitespace in Run element

When formatting a paragraph as so -




<RichTextBlock>
<Paragraph xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>

<Run></Run>

<InlineUIContainer><TextBlock >Words here</TextBlock></InlineUIContainer>

<Run xml:space="preserve"> </Run>

<InlineUIContainer><TextBlock>More words here</TextBlock></InlineUIContainer>

<Run xml:space="preserve"> Lastly some words here</Run>

</Paragraph>
</RichTextBlock>

The <Run> element containing a single space is never displayed and ignore the space=preserve property. However the last run with a leading space is displayed correctly.


How can I get a run containing a single space to display ?


Preserving whitespace in Run element

Hi BradStevenson,


You can see the whitespace working principle in XAML from http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh758290.aspx.


As we can see, “A space immediately following the start tag is deleted. it should be removed by the system. But when we add whitespace before other characters, I think it is used as a string, because “If the type of the property is Object, then the inner text is parsed as a single String. If there are intervening element tags, this results in a XAML parser error, because the Object type implies a single object (String or otherwise).” When whitespace in inner text. You can find these explanation from the above link.


So if you want to preserve the whitespace, use whitespace in string and make the system considering it as inner text.


Feel free to let me know if you have any concerns.


Regards,




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


SSRS - Deployment Issue

Are you deploying it from BUIDS itself? or using command line scripts?


Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


FTP download question










StreamWriter writer = new StreamWriter("C:\\log.txt", true)
writer.WriteLine(reader.ReadToEnd());
Console.WriteLine("Download Complete, status {0}", response.StatusDescription);

reader.Close();
response.Close();
writer.Close();




i have not tested this code, but i think it should work

MFT file transmit

You can use EnableSsl of FtpWebRequest to satisfy the encryption requirement of MFT.


http://stackoverflow.com/questions/1534908/transfer-files-over-ftps-ssl-tls-using-c-net


And then you need a remote FTP that supports FTP/S and authenticate against LDAP/AD, and generates log for file upload/download, also remember that the file system on both side must have encryption enabled (might use BitLocker or TrueCrypt).


Although not explicit requirement of MFT, security audit will usually require your server to set "Clear Page File on Shutdown" policy. Some may even require you to use 3rd party software to purge the disk region multiple times on shutdown.


Actually, I think there's a lot of requirement that you need a set of program, not single program, to implement MFT.



QUery help

Thats the way SQLServer interprets dates. Anything below 50 it will interpret century as 20 if not explicitly passed by default.


If you want to change it you need to tweak server configuration value using sp_configure


http://msdn.microsoft.com/en-IN/library/ms191004.aspx


Otherwise explicitly pass the year value in YYYY format




Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


FTP download question

Hi,


When I lookup the code associated with performing ftp downloads on MSDN... the following results.


With respect to this code... to what file location of the downloaded file ?


Thanks !



using System;
using System.IO;
using System.Net;
using System.Text;

namespace Examples.System.Net
{
public class WebRequestGetExample
{
public static void Main ()
{
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
request.Method = WebRequestMethods.Ftp.DownloadFile;

// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");

FtpWebResponse response = (FtpWebResponse)request.GetResponse();

Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
Console.WriteLine(reader.ReadToEnd());

Console.WriteLine("Download Complete, status {0}", response.StatusDescription);

reader.Close();
response.Close();
}
}
}




Passing Parameters?



//I would like this code to randomly generate the dice in the form.

private void Form1_Load(object sender, EventArgs e)
{
diceImages = new Image[6];
diceImages[0] = Properties.Resources.die_1;
diceImages[1] = Properties.Resources.die_2;
diceImages[2] = Properties.Resources.die_3;
diceImages[3] = Properties.Resources.die_4;
diceImages[4] = Properties.Resources.die_5;
diceImages[5] = Properties.Resources.die_6;


diceRoll = new int[2] { 0, 0, };
rand = new Random();
}


#region Private MethodsDice

private void button1_Click(object sender, EventArgs e)
{
RollDice();
}

private void RollDice()
{
for (int d = 0; d < diceRoll.Length; d++)
diceRoll[d] = rand.Next(6);
pictureBox1.Image = diceImages[diceRoll[0]];
pictureBox2.Image = diceImages[diceRoll[1]];
}

//On the SAME form, I would like to randomly generate cards as well.
If possible; I would then like to somehow be able to match the
dice to the card and vice versa.


private void Form1_Load(object sender, System.EventArgs e)
{
cardImages = new Image[52];
cardImages[0] = Properties.Resources.AceofClubs;
cardImages[1] = Properties.Resources.AceofDiamonds;
cardImages[2] = Properties.Resources.AceofHearts;
cardImages[3] = Properties.Resources.AceofSpades;
cardImages[4] = Properties.Resources._2ofClubs;
cardImages[5] = Properties.Resources._2ofDiamonds;
cardImages[6] = Properties.Resources._2ofHearts;
cardImages[7]= Properties.Resources._2ofSpades;
cardImages[8] = Properties.Resources._3ofClubs;
cardImages[9] = Properties.Resources._3ofDiamonds;
cardImages[10] = Properties.Resources._3ofHearts;
cardImages[11] = Properties.Resources._3ofSpades;
cardImages[12] = Properties.Resources._4ofClubs;
cardImages[13] = Properties.Resources._4ofDiamonds;
cardImages[14] = Properties.Resources._4ofHearts;
cardImages[15] = Properties.Resources._4ofSpades;
cardImages[16] = Properties.Resources._5ofClubs;
cardImages[17] = Properties.Resources._5ofDiamonds;
cardImages[18] = Properties.Resources._5ofHearts;
cardImages[19] = Properties.Resources._5ofSpades;
cardImages[20] = Properties.Resources._6ofClubs;
cardImages[21] = Properties.Resources._6ofDiamonds;
cardImages[23] = Properties.Resources._6ofHearts;
cardImages[24] = Properties.Resources._6ofSpades;
cardImages[25] = Properties.Resources._7ofClubs;
cardImages[26] = Properties.Resources._7ofDiamonds;
cardImages[28] = Properties.Resources._7ofHearts;
cardImages[29] = Properties.Resources._7ofSpades;
cardImages[30] = Properties.Resources._8ofClubs;
cardImages[31] = Properties.Resources._8ofDiamonds;
cardImages[32] = Properties.Resources._8ofHearts;
cardImages[33] = Properties.Resources._8ofSpades;
cardImages[34] = Properties.Resources._9ofClubs;
cardImages[35] = Properties.Resources._9ofDiamonds;
cardImages[36] = Properties.Resources._9ofHearts;
cardImages[37] = Properties.Resources._9ofSpades;
cardImages[38] = Properties.Resources._10ofClubs;
cardImages[39] = Properties.Resources._10ofDiamonds;
cardImages[40] = Properties.Resources._10ofHearts;
cardImages[41] = Properties.Resources._10ofSpades;
cardImages[42] = Properties.Resources.JackofClubs;
cardImages[43] = Properties.Resources.JackofDiamonds;
cardImages[44] = Properties.Resources.JackofHearts;
cardImages[45] = Properties.Resources.JackofSpades;
cardImages[46] = Properties.Resources.QueenofClubs;
cardImages[47] = Properties.Resources.QueenofDiamonds;
cardImages[48] = Properties.Resources.QueenofHearts;
cardImages[49] = Properties.Resources.QueenofSpades;
cardImages[50] = Properties.Resources.KingofClubs;
cardImages[51] = Properties.Resources.KingofDiamonds;
cardImages[52] = Properties.Resources.KingofHearts;
cardImages[53] = Properties.Resources.KingofSpades;


dealCard = new int[52] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };

rand = new Random();

}

#endregion

private void button2_Click(object sender, EventArgs e)

{
ShuffleCards();
}

private void ShuffleCards()

{

for (int c = 0; c < dealCard.Length; c++)
dealCard[c] = rand.Next(52);
label1.Image = cardImages[dealCard[0]];





Thank you, :-)



Passing Parameters?

Hi stwalker38,


I think it would be helpful if you could share us what do you want to do. If you could share us what functions you want and what result you want, then we could help to modify the code and provide useful suggestions to you.


Best Regards,


Tony


QUery help

>substring(cast('410201' as varchar),1,6)


That is not a valid date string literal.


The following is valid (YYYYMMDD format):



select convert(date,substring(cast('20410201' as varchar),1,8)) as date
-- 2041-02-01

You can just prefix the data with '20' to make it into a valid date literal.







Kalman Toth Database & OLAP Architect SQL Server 2014 Database Design

New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014











SSRS - adding hierarchy to tables, visualizations

Hello,


i recently started using SSRS. I have some problems with data presentation because I'm used to Tableau...


And I'm not ready to give up on SSRS.


I was wondering whetether it's possible to create a hierarchies in tables and - more importnat - in graphs like in Tableau.


Please let me know if one of you experts have done such a nice visualization or have some tips for me.


Amelka


Passing Parameters?



#region Using Statements
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
#endregion

namespace myCardandBonesGame1
{

public partial class Form1 : Form
{

#region Declaration


Image[] diceImages;
int[] diceRoll;
Random rand;
Image[] cardImages;
int[] dealCard;


#endregion
#region Inititalization


public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
diceImages = new Image[6];
diceImages[0] = Properties.Resources.die_1;
diceImages[1] = Properties.Resources.die_2;
diceImages[2] = Properties.Resources.die_3;
diceImages[3] = Properties.Resources.die_4;
diceImages[4] = Properties.Resources.die_5;
diceImages[5] = Properties.Resources.die_6;


diceRoll = new int[2] { 0, 0, };
rand = new Random();
}


#region Private MethodsDice

private void button1_Click(object sender, EventArgs e)
{
RollDice();
}

private void RollDice()
{
for (int d = 0; d < diceRoll.Length; d++)
diceRoll[d] = rand.Next(6);
pictureBox1.Image = diceImages[diceRoll[0]];
pictureBox2.Image = diceImages[diceRoll[1]];
}

#endregion





#region Inititalization

private Form1()

//I get Error: 1Type 'myCardandBonesGame1.Form1' already defines a member called 'Form1' with the same
parameter type myCardandBonesGame1

{
InitializeComponent();
}

#region Public MethodsCards
Is there a way to pass the parameters in this code? I'm not sure what to do here.
I am very new to coding learning on my own, so if you do respond please put it in laymen
terms, so that I may understand better. Thanks.



private void Form1_Load(object sender, System.EventArgs e)

//I get Error: 1Type 'myCardandBonesGame1.Form1' already defines a member called 'Form1' with the same
parameter type myCardandBonesGame1

{
cardImages = new Image[52];





Thank you, :-)


Passing Parameters?

For the first error you're trying to create a private constructor when a public constructor is already defined. Remove your private constructor as you cannot use it with Winforms anyway.


The second error is the same problem. You already have defined a method called Form1_Load so you cannot define it again.


You can pass parameters to methods you write. However you cannot pass parameters to methods that are defined through other means such as part of event handlers or via interface methods. In those cases you will generally store data within your class rather than passing it around as parameters. If you need to pass data into your class and you cannot use method parameters then use properties to store the values instead. The method can then reference the properties as needed.


Michael Taylor

http://blogs.msmvps.com/p3net


Facebook Integration in Store App

I am developing an store app and I need to implement facebook integration to access friends and post status using this. I have done this using WP8 and WP7 but these methods do not work anymore. Can anybody provide any sample for facebook Integration?

Facebook Integration in Store App

Hi,


You can look for the link below:


http://facebooksdk.net/docs/windows/


The link above has some tutorials and samples about how to integrating Facebook into a C#/XAML based Windows Store app.


And if you have any other problems about how to use Facebook SDK API, you should go to the Facebook support forum:


https://developers.facebook.com/support/


Best Wishes for you!




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.


Can I use Visual Studio 2008 project/item templates in 2013?

Hi techieplaya,


According to your description, my understanding is that you want to know if the templates created in Visual Studio 2008 can directly import to Visual Studio 2013.


Per my knowledge, the templates created in Visual Studio 2008 can directly import to Visual Studio 2013.


If you still have any question about this question, I suggest you can create a post in Visual Studio forum, more experts will help you and you will get more helpful information from there.


https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vsarch%2Cvstfs&forum=visualstudiogeneral%2Clightswitch%2Cvsx%2CTFService%2Cvstest%2Clsextensibility%2CApplicationInsights&filter=alltypes&sort=lastpostdesc


Best regards




Zhengyu Guo

TechNet Community Support




Combine two lists in one form (1 to Many relation)

I have two list instances. I have a custom form on which I would like to show two lists and add more button to let user select to add more child records and save which should save in both the lists. And again when user pull the item from main list it should display the child list items as well. Can someone point me good link to achieve this.


Thanks,


Alex


SharePoint foundation not allowing attachments on customized forms

You mean to say the OOB attach file option is not working as expected?


Thanks, Ashish | Please mark a post helpful/answer if it is helpful or answer your query.


WCF Url Rewriting using global.asax

I think maybe you should also ask in a wcf specific forum.


.


Maybe it's the web config.


Are you switching sites and if so so you have:




<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />

If that's not the issue then maybe you can get more info with some failed request tracing:


http://www.iis.net/learn/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules




Please don't forget to upvote posts which you like and mark those which answer your question.

My latest Technet article - Dynamic XAML


Is there a way to skip log on using code for an asp.net application?

If this is regular asp.net you need impersonation.


Here are my notes on this:



Both server and client must be in the intranet zone.
Code - note the iis configuration in comments:
string EditorGroup = (string)ConfigurationManager.AppSettings["EditorGroup"];
string AdminGroup = (string)ConfigurationManager.AppSettings["AdminGroup"];

// Hosting web site must have:
// Anonymous authentication disabled
// Asp.Net Impersonation enabled
// Windows Authentication enabled
// appPool used must be classic asp.net appPool ( in advanced settings for web site ).

string WithDomain = HttpContext.Current.Request.LogonUserIdentity.Name.ToString();
string JustName = WithDomain.Substring(WithDomain.LastIndexOf('\\') + 1);

bool IsAdmin = IsInGroup(WithDomain, AdminGroup);
bool IsEditor = IsInGroup(WithDomain, EditorGroup);

Method to do isinrole
private bool IsInGroup(string user, string group)
{
try
{
using (var identity = new WindowsIdentity(user))
{
var principal = new WindowsPrincipal(identity);
return principal.IsInRole(group);
}
}
catch
{
return false;
}

}

In web.config
<system.web>
<authentication mode="Windows" />


The isingroup stuff is checking whether the user is in a particular AD user group.


You can also check that in web.config



<system.web>
<authentication mode=“Windows“/>
<identity impersonate=“true“/>
<authorization>
<allow roles=“Your group“/>
<deny users=“*“/>
</authorization>
</system.web>





http://www.codeproject.com/Articles/175028/ASP-NET-Windows-Authentication-Authorization-by-Gr




Please don't forget to upvote posts which you like and mark those which answer your question.

My latest Technet article - Dynamic XAML


35101/0006/2008/AV,35101/0006/2008/AV . this is my RO_NO space issue

What does below query provides in result?



select * from S_RELEASE_ORDER_MAIN
where ro_no='35101/0006/2008/AV'





-Vaibhav Chaudhari


Implementing pull to refresh behaviour

Hi BradStevenson,


Sorry for a late response, since there is a ScrollViewer inside ListView, how about programmatically scroll the ScrollViewer to hide your refresh cell?


--James




We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

Click HERE to participate the survey.


How do I pause my loop until text-to-speech has read every word in a string?

If you need help please provide full and clear information on what you are doing. A code snippet showing what you're trying to do is helpful as well as a clear explanation of the expected results and how they differ from the actual results. If it takes a large amount of code to reproduce the problem (several files, or more than a screen) then please share a minimal repro on your OneDrive.


That said, I'll guess that this.media is a MediaElement, in which case you can listen to the MediaElement.CurrentStateChanged property to detect when the media finishes playing.


How do I pause my loop until text-to-speech has read every word in a string?

You won't really be able to do this in a loop properly. You will have to adopt an event driven approach. Basically you would read the first paragraph, register to the MediaElement's CurrentStateChanged Event and then have the MediaElement read it out loud. When the event triggers you would then load the next paragraph and start Playback again. When Playback finished the event would trigger and you would read the next paragraph, etc.


Basically that is what async/await does behind the scenes anyway in APIs that support it - it just hides those details and makes it easier to write and read asynchronous code.


One way to perhaps optimize this would be to start playback and immediately load the next paragraph using a ThreadPool thread so it's already loaded and synthesized when the event fires. You would then have it read the next paragraph and again launch your ThreadPool thread to load the next one.


RDLC report fails to build simple expression

.



SSRS causing to reboot

.


Help with adding a user copying permissions from another user $RoleDefinition.Name SharePoint 2010 Powershell

Hello,


Sorry for delay.


I think role is already assigned so you don't need to assigned again in second BOLD row. So you may delete "$role = $web.RoleDefinitions.[$newRoleDef]" line then execute your code.


Hope it could help




Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help


GROUP BY TINYINT

I have this simple query:



SELECT t1.col1, t2.col2
FROM dbo.tbl1 t1 INNER JOIN tbl2 t2
ON...
GROUP BY t1.col1, t2.col2

but I get error: "Cannot call methods on tinyint"

TinyInt column is t2.col2.



From when you cannot use group by on tiny int column?



What is interesting is that DISTINCT works without error:



SELECT DISTINCT t1.col1, t2.col2
FROM dbo.tbl1 t1 INNER JOIN tbl2 t2
ON...

Can someone explain? In the past DISTINCT and GROUP BY worked the same(same execution plan). I have SQL 2014 developer version.


GROUP BY TINYINT

Not able to simulate your issue. The below code works for me in SQL Server 2014.


Could you please share your complete code or simple simulated code?



create Table T1(Col1 tinyint, col2 tinyint)
create Table T2(Col1 tinyint, col2 tinyint)

SELECT t1.col1, t2.col2
FROM dbo. t1 INNER JOIN t2
ON t1.col1 = t2.col1 and t1.col2 = t2.col2
GROUP BY t1.col1, t2.col2

SELECT DISTINCT t1.col1, t2.col2
FROM dbo. t1 INNER JOIN t2
ON t1.col1 = t2.col1 and t1.col2 = t2.col2
--GROUP BY t1.col1, t2.col2

Drop table T1,T2


Change tracking version

I would like to get change tracking version for specific database(not the one stored procedure is running), something like:


SELECT test.dbo.CHANGE_TRACKING_CURRENT_VERSION();


Is that possible?


br, Simon


Change tracking version

this?


http://solutioncenter.apexsql.com/methods-for-auditing-sql-server-data-changes-part-2-reading-the-change-tracking-results/




Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


Change tracking version

Erland,


you will know :)


I'm using this tracking version to call some procedure on my remote server:



EXEC('[dbo].[my_procedure] ?', @change_tracking_version) AT [myRemoteServer]

Inside this procedure on remote server I'm reading back one table which is on local server:



INSERT INTO #tmp_category ( code )
SELECT code FROM OPENROWSET('SQLNCLI', 'Server=myServer;Trusted_Connection=yes;', 'set fmtonly off SELECT * FROM myDb.dbo.item_category WHERE transfer=0')

But I get an error:

"Access to the remote server is denied because no login-mapping exists."


How can I solve this issue with retaining trusted connection - since I don't won't to write user name and password into the code.


Change tracking version

First of all, stop using SET FMTONLY OFF in your distributed queries. It has the effect that the query is executed twice. And for the cases where it works on SQL 2008, it will not work when both servers are running SQL 2012 or SQL 2014 or higher. (In this particular case, it serves no purpose at all.)


Next, I don't exactly follow why you are using OPENROWSET in the first place. As you saiying that you are on ServerA, and you make a call to ServerB and on ServerB you are running a query back to ServerA?


I don't know why you are doing this, but can't you collect the data on serverA and pass it in an XML document to serverB? (The actual parameter type would have to be nvarchar(MAX).)


The error message you get indicates that serverB is not able to make a trusted connection to serverA, which may be a double-hop issue. Which is a Windows problem, not an SQL Server problem. But if you set up a regular linked server, you can add login-mapping, if that is feasible, without storing username and password in the code.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Implementing "IsDirty" for XAML TextBox

I believe the best approach would be to add the IsDirty flag to the ViewModel of the page. So when the bound data is modified IsDirty gets set to true. I guess your ViewModel implements INotifyPropertyChanged so basically whenever you would fire the PropertyChanged Event you would set IsDirty to true. Whenever the data gets saved or reset you would reset it to false.


All your UI logic would work based on the ViewModel (e.g. binding Button states to IsDirty).


The general idea behind using a ViewModel in addition to a model (otherwise you could simply bind the Model-objects to the UI) is to have all necessary logic for the UI behavior and state be encapsulated in the ViewModel.


Hope that helps.


Monday, December 29, 2014

Generated Script fails when attempting to drop Foreign Key Constraint

First question is whether you were running it on the correct database. Did you select option script USE database to True. Otherwise it will not have USE DBName on top and so if you just open it in a query editor window and execute it it will try to execute it against the default db (or master) which may not be where you have created those tables and constraints originally.


Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page


SQL Server 2008 R2 sys.foreign_keys, is_not_trusted column

Hi, We are using SQL Server 2008 R2 database and we have different environments like, DEV, QA, UAT, Pre-Prod & Prod. We are TFS 2012 as our source code repository and when I tried to publish my database project to DEV it worked fine but to publish it to QA I got the below error.


"The ALTER TABLE statement conflicted with the FOREIGN KEY constraint"


When I tried to drop & create this constraint in DEV it was working absolutely fine, but in QA it threw that error message. After further investigation when I ran the below query in DEV, QA.



SELECT [name], type_desc, is_disabled, is_not_trusted
FROM sys.foreign_keys

In DEV is_not_trusted = 0 & QA is_not_trusted = 1


Is this affected by "NOT FOR REPLICATION" (We were modifying few tables to work for Replication very recently and this was the first time we were doing a deploy to QA server after this change) on the table & is_not_for_replication column in the sys.foreign_keys (but is_not_for_replication = 0 for this table)?


How does it get set?


Thanks in advance......




Ione


SQL Server 2008 R2 sys.foreign_keys, is_not_trusted column

that setting is effected by NoCheck setting while creating constraint. below is the sample.



use tempdb
go
drop table foo, bar;

create table foo(i int primary key)
go
create table bar(i int primary key)
go
insert into foo values (2)
go
insert into bar values (1)
go
-- Below would give error
ALTER TABLE foo
ADD CONSTRAINT FK_foo_bar FOREIGN KEY(i)
REFERENCES bar (i)
go
-- Below would succeed
ALTER TABLE foo WITH NOCHECK
ADD CONSTRAINT FK_foo_bar FOREIGN KEY(i)
REFERENCES bar (i)
go

-- We created the FK constraint without checking existing records.

select name, is_not_trusted from sys.foreign_keys







Balmukund Lakhani

Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker

--------------------------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------------------------------------------------------------------

My Blog | Team Blog | @Twitter | Facebook

Author: SQL Server 2012 AlwaysOn - Paperback, Kindle


SQL Server 2008 R2 sys.foreign_keys, is_not_trusted column

Hello Ione,


Or repair the untrusted FK: Repair Not Trusted FK Constraints




Olaf Helper


[ Blog] [ Xing] [ MVP]

How to change app theme in WP8.1 at runtime

I have created a test project to verify changing theme at runtime, but it does not work as what I expect. Here is my code:


App.xaml



<Application
x:Class="AppThemeTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppThemeTest">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Style.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

Style.xaml



<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppThemeTest">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="B" Color="Yellow"></SolidColorBrush>
<SolidColorBrush x:Key="F" Color="Blue"></SolidColorBrush>
</ResourceDictionary>

<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="B" Color="Blue"></SolidColorBrush>
<SolidColorBrush x:Key="F" Color="Yellow"></SolidColorBrush>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

MainPage.xaml:



<Page
x:Class="AppThemeTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppThemeTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
RequestedTheme="Light"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>
<StackPanel Margin="19,40,19,0">
<Border BorderBrush="{StaticResource B}" BorderThickness="8" Margin="10">
<TextBlock Foreground="{StaticResource F}" FontSize="28" Text="Hello" Margin="10"/>
</Border>

<ToggleSwitch OnContent="Light" OffContent="Dark" IsOn="True" Toggled="ToggleSwitch_Toggled" Header="Change theme" />
</StackPanel>
</Grid>
</Page>



part of MainPage.xaml.cs



private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
{
if (this.RequestedTheme == ElementTheme.Light)
{
this.RequestedTheme = ElementTheme.Dark;
}
else
{
this.RequestedTheme = ElementTheme.Light;
}
}



The result is that: the theme of the page and the ToggleSwitch control can be changed successfully, but the Border and the TextBlock cannot, their style are specified by me in the Style.xaml. Then what's the problem?



SSRS 2012: Subtract multiple column values from one

I tried this too..


whats surprising is it only shows the value of the 1st column?...what can the issue be there?


SSRS 2012: Subtract multiple column values from one

Hi Vishakh,


See sample data and result below:





The last column with values 6073, 5281 and 5365 is the column which should show the difference between the remaining columns


SSRS 2012: Subtract multiple column values from one

Show your test data for that row.


I think you are subtracting the values that will generate result that is equal to first column.


you have another option you can subtract the report items like;



= ReportItems!col1.Value - ReportItems!col2.Value - Reportitems!col3.Value - Reportitems!col4.Value



Thanks




Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com


Browser application validation

Well, the question is that, i can earn a Microsoft license for this project? Or you can earn only for windows desktop applications?

Browser application validation

There's no such thing for a web application.


You have one for windows store app development:


http://msdn.microsoft.com/en-gb/library/windows/apps/hh974578.aspx




Please don't forget to upvote posts which you like and mark those which answer your question.

My latest Technet article - Dynamic XAML


Browser application validation

Sorry, I think I didn't ask the right question, I want to earn a Microsoft silver partnership with my application, and I want to know if it is possible for a .Net web application made with Visual Studio?

UI Thread?

Hello,


I'm new to C#.


In my code, I'm using a While loop in my main. This made it so that the code launches without any UI.


How can I get it to launch with the UI and how do I change "maptimerlabel.Text" from another thread for example?


This is my code, if you could explain or edit the code for me I would be very happy.



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;
using Magic;
using System.Threading;
using WindowsInput;

namespace Program
{
public partial class frmmain : Form
{
public frmmain()
{
InitializeComponent();
BlackMagic swr = new BlackMagic();
swr.OpenProcessAndThread(SProcess.GetProcessFromProcessName("Game.exe"));
uint timeraddress = 0x00286C60;


int[] click = new int[15] { 21750, 21916, 22083, 22166, 22250, 22416, 22583, 22749, 22833, 22916, 23000, 23083, 23249, 23416, 23500 };

int offset = 0;
int holdtime = 40;
int clickcounter = 0;
while (1 == 1)
{

int maptimer = swr.ReadInt(timeraddress);
maptimerlabel.Text = "Map Time: " + maptimer;
if (maptimer >= click[clickcounter] + offset)
{
InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_N);
Thread.Sleep(holdtime);
clickcounter = clickcounter + 1;
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_N);
}
}
}


}
}