Saturday, February 28, 2015

How to get table result from XML

Try this,



DECLARE @XML xml ='
<E1EDP01 SEGMENT="1">
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>A1</IDTNR>
<KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>E1</IDTNR>
</E1EDP19>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>A2</IDTNR>
<KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>E2</IDTNR>
</E1EDP19>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>A3</IDTNR>
<KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>E3</IDTNR>
</E1EDP19>
</E1EDP01>'
SET @XML = '<ROOT>' + CAST(@XML AS NVARCHAR(MAX)) + '</ROOT>'
SET @XML = CAST(@XML AS XML)

;WITH CTE AS (
select t.u.value ('QUALF[1]','varchar(10)') as QUALF,
t.u.value ('IDTNR[1]','varchar(30)') as IDTNR,
t.u.value ('KTEXT[1]','varchar(30)') as KTEXT,
t.u.value ('..','varchar(30)') as DESCR
from @XML.nodes('/ROOT/E1EDP01/E1EDP19') t(u)
)

SELECT [002] AS ProductCode1,[003] AS ProductCode2 FROM (SELECT QUALF,IDTNR,DESCR FROM CTE) X
PIVOT(MAX(IDTNR) FOR QUALF IN ([002],[003])) PVT








Regards, RSingh


How to disable number detection in WebView Html?

Hi PM16,


I still cannot repro the issue on Windows Phone by the code you provided.


I may need more information so that I can give some suggestions.


--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.


Deserialize to object

Hi!


I found the below code for how to deserialize data from a file. But the code only returns a string representing the data, not the original object. How can I get it to deserialize into the same object as it was serialized from?


Thanks, Sigurd F



string content = String.Empty;

var myStream = await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync(JSONFILENAME);
using (StreamReader reader = new StreamReader(myStream))
{
content = await reader.ReadToEndAsync();
}
var obj = App.Current as App;
//obj.objectGraph = content;


Deserialize to object

can you show the code how you serialized? wondering which component you use for that


Microsoft Certified Solutions Developer - Windows Store Apps Using C#


Deserialize to object

Here are both the code for serialization and the classes I serializes.



private async Task writeJsonAsync()
{
// Notice that the write is ALMOST identical ... except for the serializer.

//var myCars = buildObjectGraph();
var groups = await WordsDataSource.GetGroupsAsync();
this.DefaultViewModel["WordsGroups"] = groups;


var serializer = new DataContractJsonSerializer(typeof(IEnumerable<WordsGroup>));
using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(
JSONFILENAME,
CreationCollisionOption.ReplaceExisting))
{
serializer.WriteObject(stream, groups);
}

resultTextBlock.Text = "Write succeeded";
}


[DataContract]
public class WordsItem
{
public WordsItem(String no, String en, String sp)
{
this.No = no;
this.En = en;
this.Sp = sp;
}

[DataMember]
public string No { get; private set; }
[DataMember]
public string En { get; private set; }
[DataMember]
public string Sp { get; private set; }
}


[DataContract]
public class WordsGroup
{
public WordsGroup(int id, String lesson, String info)
{
this.Id = id;
this.Lesson = lesson;
this.Info = info;
this.Items = new ObservableCollection<WordsItem>();
}

[DataMember]
public int Id { get; private set; }
[DataMember]
public string Lesson { get; private set; }
[DataMember]
public string Info { get; private set; }
[DataMember]
public ObservableCollection<WordsItem> Items { get; set; }


public override string ToString()
{
return this.Lesson;
}
}

Thanks, Sigurd F

Deserialize to object

Hi Sigurd,


According to this page, http://ift.tt/1LZlQL6, you need to read the json file to MemoryStream object, then use ReadObject method to parse to the available class. Code snippet may look like the following.



MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));

DataContractJsonSerializer ser = new DataContractJsonSerializer((typeof(WordsItem));

item = ser.ReadObject(ms) as WordsItem;

Try and let me know the result.


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.


Is it possible to add Event Handler in separate ResourceDictionary directly?

check this code sample command binding in DataTemplate. http://ift.tt/1E2j7zq

Is it possible to add Event Handler in separate ResourceDictionary directly?

Hi Silverbird2015


>> Is it possible to add Event Handler in separate ResourceDictionary directly?


According to your description, I assume you want to add event handler in DataTemplate in Resource Dictionary at runtime. It seems you are making thing more complex. Are you want to separate the Data and UI, if so, I suggest you take a look at MVVM pattern in windows store app. http://ift.tt/18bbubV.


If I have any misunderstanding, please post more information about your scenario.


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.


How to capture an event our of my application range?

you can capture mouse events only when your application has current focus. in other words, you can subscribe to mouse events on your parent form & when the mouse enters your form, raised events will be captured.


on the same line, if you need your combobox to respond to mouse events, simply subscribe to the same & it will work but only when its currently on focus i.e. you should already have selected the combobox with your mouse / keyboard.


hope this helps!


Executing Stored Procedure using Command Object

I defined SP in the SQL Server like following.



IF OBJECT_ID('Sales.GetCustomerOrders', 'P') IS NOT NULL
DROP PROC Sales.GetCustomerOrders;
GO

CREATE PROC Sales.GetCustomerOrders
@custid AS INT,
@fromdate AS DATETIME = '19000101',
@todate AS DATETIME = '99991231',
@numrows AS INT OUTPUT
AS
SET NOCOUNT ON;

SELECT orderid, custid, empid, orderdate
FROM Sales.Orders
WHERE custid = @custid
AND orderdate >= @fromdate
AND orderdate < @todate

SET @numrows = @@rowcount;
GO

I want to make client code including SqlCommand, SqlParameter, InputParameter and SqlDataReader.

How to get data and put into List<string>?


Executing Stored Procedure using Command Object

Why do you need to use those entities? Homework?


Anyway, I would rather use some framework to map the stored procedure. In the article linked below you will find an example using Entity Framework. This way you will get a lot of the code for free.


Stored Procedures in the Entity Framework


Executing Stored Procedure using Command Object

Here is link to older topic containing usefull sample.

Executing Stored Procedure using Command Object

Sorry, my question was so ambigous.


Actually I wanted to know how to set multiple input parameter from the client side code.



Sqlserver 2012 Cache Hit Ratio

Hi,


I am not sure how you are calculating BCHR but below query would give you correct value,Source



SELECT cast((CAST(A.cntr_value1 AS NUMERIC) / CAST(B.cntr_value2 AS NUMERIC))*100 as decimal(10,2)) AS Buffer_Cache_Hit_Ratio

FROM (

SELECT cntr_value AS cntr_value1

FROM sys.dm_os_performance_counters

WHERE object_name = 'SQLServer:Buffer Manager'

AND counter_name = 'Buffer cache hit ratio'

) AS A,

(

SELECT cntr_value AS cntr_value2

FROM sys.dm_os_performance_counters

WHERE object_name = 'SQLServer:Buffer Manager'

AND counter_name = 'Buffer cache hit ratio base'

) AS B



if you read the article by Jonathan it clearly says don't rely on BCHR for gauging memory pressure




Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it



My Technet Wiki Article


MVP



Sqlserver 2012 Cache Hit Ratio

I concur with Shanky. Instead of BCHR, use Page Life Expectancy to check for memory pressure


Satish Kartan www.sqlfood.com


Sqlserver 2012 Cache Hit Ratio

I concur with Shanky. Instead of BCHR, use Page Life Expectancy to check for memory pressure


Satish Kartan www.sqlfood.com



I would like to add here that if the system is NUMA again PLE should not be looked upon but PLE for each NUMA node should be looked upon this is becuase PLE as such on NUMA node is avarage of PLE's of all NUMA nodes. The reason I am asking to avoid is becase if server is having NUMA nodes and if there is memory pressure PLE corresponding to that node(Node facing memory crunch) will dip down but avrage PLE would remain high and this would gibe user feeling that PLE is fine when actually there was memory pressure. Remember in NUMA configuration each node beahves as it ha its own memory management. The details are explaiined by Paul in his article PLE Is not what you think


If you really want to test memory pressure there are other Perfmon counters



  • SQLServer:Buffer Manager--Page Life Expectancy(PLE) for EACH NUMA nodes.

  • SQLServer:Buffer Manager--CheckpointPages/sec:

  • SQLServer:Memory Manager--Memory Grants Pending:

  • SQLServer:memory Manager--Target Server Memory:

  • SQLServer:memory Manager--Total Server memory

  • Page reads/secNumber of physical database page reads that are issued per second. This statistic displays the total number of physical page reads across all databases. Because physical I/O is expensive, you may be able to minimize the cost, either by using a larger data cache, intelligent indexes, and more efficient queries, or by changing the database design

  • Free PagesTotal number of pages on all free lists (free lists track all of the pages in the buffer pool that are not currently allocate to a data page, and are therefore available for usage immediately)

  • Free List Stalls/secNumber of requests per second that had to wait for a free page




Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it



My Technet Wiki Article


MVP


Application-level touch handling

Is there a way (for universal apps) to handle touches on App level? Like we can do with Silverlight ( Touch.FrameReported).


I need to get a raw touch data for statistics and I dont need to know about what controls are added. I've tried to use a CoreWindow for that purpose, but PointerMoved never fired when some controls are handling touch. It works _only if there is no controls. I've tested it with HubApp template.


I'm new in WinRT development, please, let me know what I'm doing wrong. Thanks.


Application-level touch handling

Hi Nerthym,


I may consider this documentation should helps: Events and routed events overview


To fire some event on the Page control while you have some touch on the screen, you can register a event handler to the Page, see this for more information: AddHandler method


--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.


Application-level touch handling

Hi. I've done it. But it still not fired when there is Hub or Pivot controls. Also I need the same handler (for stats) on every page no matter how many pages are in app.

Application-level touch handling

Hi Nerthym,


By following code I can have pointer move event fired when I have add a pointer move event to the root page, if you cannot fire the event, please share your code with us for a better analysis.


If you need same handler for every page probably you need attach the event manually to each page.



--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.


Application-level touch handling

Thanks for your information, I did only test on a hub template on Windows Store App, I did not test on Windows Phone real device or emulator. Will test later and reply here once I have some update.


--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.


Application-level touch handling

I still need someone to help with this. Thanks.

Application-level touch handling

Hi Nerthym,


I can reproduce your issue on emulator, I will consult some of our senior engineers for a explanation. Thanks for your understanding.


--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.


Duplicate Items in ListView (Windows Phone 8.1)

Hi MohanRajk,


Per my understanding, the method generates the clild listview items may have the same logic for every button call. You should check that method and modify to let it know how to generate different items. Pass a parameter in that method to indicate the item in parent lsitview and generate clild listview item according to the parameter.


If you don’t know how to do, please post some code snippet about this scenario.


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.


Duplicate Items in ListView (Windows Phone 8.1)

If you still cannot make it work, can you submit a repro project to show it in detail using your OneDrive?


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.


Data inserted and System.NullReferenceException error message on ViewModel class

Hi Fabio,


Per my understanding, this issue may be caused by the Acesso property in Funcionario class. I found that you’ve not initialized that property. Try use the following code, test it and let me know the result.



public class Funcionario

{

public string Id { get; set; }

public int RE { get; set; }

public string Nome { get; set; }


public virtual Acesso Acesso { get; set; }


public Funcionario()

{

Acesso = new Acesso();

}

}

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.


Data inserted and System.NullReferenceException error message on ViewModel class

Dear Herro Wong,


I did what you said but nothing change in my project. When I run as debug mode after I clicked button the code stopped saying System.NullReferenceException error.


I've tried initialize all my properties, class and etc. I removed null value from local parameter even so, when I run the project, I got the same error message.


I don't know that to do next. If do you get some insight about it, please let me know.


Thanks.


Data inserted and System.NullReferenceException error message on ViewModel class

Hi Fabio,


Can you try making a mini repro project about this issue? I need code snippet to look into it and know how to fix this. Use your OneDrive and share a link here.


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.


Data inserted and System.NullReferenceException error message on ViewModel class

Hi Fabio,


I am not familiar with Azure programming, so I try replacing GetAllAcessosAsync method to use local data. You can see the following code snippet. When I run the project, it throw exception to say the Acessos property is null reference.



Please try init it in MyWindows8AppViewModel constructor like the following.


Acessos=newMobileServiceCollection<Acesso,Acesso>( newIMobileServiceTableQuery<Acesso>)


I don’t know how to create an instance of the IMobileServiceTableQuery interface, so you need do it by yourself.


Try and let me know the result.


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.


Storing Values

Hi,



When reading and XML file I want to have the value of an Attribute to hold the value of the InnerText



For example:



<Name type="firstname" id="21">Susan</Name>

<Name type="country" id="22">Spain</Name>



So when reading the XML I have a string called firstname with the value Susuan and country has the value Spain. In php it would be "$$key = $value;" but in c# I am not sure. What I don't want to do is manually set each value and they will change.



Thanks in advance.







Storing Values

Sorry I totally missed that part out, mymistake. It's windows app in c# that gets an xml reply from an API. I want to assign the values to strings so they can be called up further along.

Storing Values

The parent is "FieldSet".


I already have access to the values "type" and the inner value that is relates to, what I dont know is how to have the types value changed to a string and the inner value assigned to it.




NetworkInterface.OperationalStatus is not updating while program runs

Hello,


I wrote the following code:



NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();

while (true)
{
System.Console.WriteLine(adapters[0].OperationalStatus);

Thread.Sleep(1000);
}

As you can see the code prints the network adapter's status every 1 sec.


When an Ethernet cable is connected, the print is "Up".


But when I disconnected the cable, the print continues to be "Up".


If I start over when the link is down, the print changes to "Down" but not online when the program runs.


Can you help ?


Best regards,


Z.V


NetworkInterface.OperationalStatus is not updating while program runs

Hello,


I think the code should be:



while (true)
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();

System.Console.WriteLine(adapters[0].OperationalStatus);

Thread.Sleep(1000);
}

With this code, when I disconnect the cable while program is running, the current status is printed.


Best regards,


Z.V


SQL Query Script

Jason,


Thank you. I tried the query,but it is giving negative values and greater than 1 to the Due`s and Received.


For each clientID it has to show either 0 or 1. Those are the only 2 values I have to dispaly.


SQL Query Script

Just need to alter the COUNT condition in "FollowUpsReceived"...



IF OBJECT_ID('tempdb..#Interview_Sample') IS NOT NULL DROP TABLE #Interview_Sample
CREATE TABLE #Interview_Sample (
ClientID VARCHAR(10),
GrantNo VARCHAR(10),
SubmissionDate DATE,
InterviewTypeCode VARCHAR(20)
)

INSERT INTO #Interview_Sample
VALUES
('ABC123','SM04111','2010-01-19','BASELINE'),
('ABC123','SM04111','2010-03-12','Three_Months'),
('MNC123','XX08000','2010-02-19','BASELINE'),
('MNC123','XX08000','2010-06-12','Three_Months'),
('ORC456','ABC9000','2012-10-20','BASELINE'),
('ORC456','ABC9000','2013-10-20','Three_Months')


SELECT
bl.ClientID,
bl.GrantNo,
1 - COALESCE(COUNT(CASE WHEN DATEDIFF(mm, bl.SubmissionDate, fu.SubmissionDate) <= 3 THEN 1 END) OVER (PARTITION BY bl.ClientID), 0) AS FollowUpsDue,
COUNT(CASE WHEN DATEDIFF(mm, bl.SubmissionDate, fu.SubmissionDate) <= 6 THEN 1 END) OVER (PARTITION BY bl.ClientID) AS FollowUpsReceived
FROM (
SELECT
isa.ClientID,
isa.GrantNo,
isa.SubmissionDate
FROM
#Interview_Sample isa
WHERE
isa.InterviewTypeCode = 'BASELINE'
) bl
LEFT JOIN (
SELECT
isa.ClientID,
isa.SubmissionDate
FROM
#Interview_Sample isa
WHERE
isa.InterviewTypeCode <> 'BASELINE'
) fu
ON bl.ClientID = fu.ClientID

I don't know the specific alterations you made to my last piece of code to make it work so I couldn't apply it here. Just do the same thing again and you should be good to go. :)



Jason Long



Hub.Header margin/border hides right aligned text

Hi,


I want to have some text aligned all the way to the right in the Hub.Header. But then there is a right margin/border that hides part of the text on the right side.


How do I get rid of that margin/border or how do I get the text to be all the way to the right?


This is what I have:



<Hub Name="MyHub">
<Hub.Header>
<TextBlock Text="Something" TextAlignment="Right" Width="{Binding ActualWidth, ElementName=MyHub}"></TextBlock>
</Hub.Header>
<HubSection>
<DataTemplate>
<TextBlock Text="Some content here"></TextBlock>
</DataTemplate>
</HubSection>
</Hub>


Hub.Header margin/border hides right aligned text

Hi Amy,


Do you know if there is a way to remove the horizontal space on the right side?


Hub.Header margin/border hides right aligned text

A workaround is to place the header outside the hub control. This works for my scenario.

But it would have been nice to do it inside the hub control also.

Report Builder 3.0 on SharePoint - "refreshing" issue.

Hi crystal-pete,


Based on my understanding, there is an issue about the report refreshing, right?


In your scenario, I would to know if only this report comes across this issue. If that is a case, the issue could cause by the AutoRefresh RDL element: <AutoRefresh>. Please check if you have specified the value for this element within .rdl file. For more information, please refer to this article: Automatically refreshing your SQL Reporting Services reports with the AutoRefresh element. Otherwise, please provide more details about how to reproduce the issue.


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


Best regards,

Qiuyun Yu




Qiuyun Yu

TechNet Community Support




Semantic Zoom - Show letters containing no items

Yes, it only shows the letters that contain children items.

How to draw on a bitmap with a Windows Store application using C#

I cannot figure out how to draw on a bitmap in a Windows Store (RT) application.


I want to draw pixel by pixel, setting the color.


It looks like I need a WriteableBitmap, but I am unsure how to get the pixel format correct.


All the examples I have found seem to read a bitmap from file and extract the pixel format from there. I am not starting from file. I am starting from a blank bitmap.


Does anybody have a simple example of just image on a form, draw pixels on bitmap in the image?


SQL Query Script

This should do the trick for you...



IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
CREATE TABLE #Interview_Sample (
ClientID VARCHAR(10),
GrantNo VARCHAR(10),
SubmissionDate DATE,
InterviewTypeCode VARCHAR(20)
)

INSERT INTO #Interview_Sample
VALUES
('ABC123','SM04111','2010-01-19','BASELINE'),
('ABC123','SM04111','2010-03-12','Three_Months'),
('MNC123','XX08000','2010-02-19','BASELINE'),
('MNC123','XX08000','2010-06-12','Three_Months'),
('ORC456','ABC9000','2012-10-20','BASELINE')


SELECT
bl.ClientID,
bl.GrantNo,
1 - COALESCE(COUNT(CASE WHEN DATEDIFF(mm, bl.SubmissionDate, fu.SubmissionDate) <= 3 THEN 1 END) OVER (PARTITION BY bl.ClientID), 0) AS FollowUpsDue,
COUNT(fu.ClientID) OVER (PARTITION BY bl.ClientID) AS FollowUpsReceived
FROM (
SELECT
isa.ClientID,
isa.GrantNo,
isa.SubmissionDate
FROM
#Interview_Sample isa
WHERE
isa.InterviewTypeCode = 'BASELINE'
) bl
LEFT JOIN (
SELECT
isa.ClientID,
isa.SubmissionDate
FROM
#Interview_Sample isa
WHERE
isa.InterviewTypeCode <> 'BASELINE'
) fu
ON bl.ClientID = fu.ClientID

HTH,


Jason




Jason Long


Jagged Lists (nested List ) performance

I am designing a game, and I need to keep track of a 3d list of geometry chunks. Before I build upon this, I would like to know about performance and such with using nested List<T>


Example:



public List<List<List<Chunk>>> Chunks;
int x=0,y=0,z=0;
Chunks[x][y][z].SomeProperty = 0;



I am concerned with lookup speed, and drawbacks. When the world gets to be lets say 10K chunks in size, is this method really the best approach?



(=Chris=)


Search and replace string inside a column

Hi,


in my table there is Column A with Type NVARCHAR.


i need to search inside all the rows in that column to find the string "_TH" and remove it wherever it exist.


how can i do it?


Search and replace string inside a column

Do like this



declare @str nvarchar(40)
set @str='Test_TH'

select replace(@str,'_TH','')





Many Thanks & Best Regards, Hua Min


DataTemplateSelector not being called

I have a DataTemplateSelector defined as follows:

Public Class FigureBindingTemplateSelector : Inherits DataTemplateSelector
Public Property TextFigureBindingTemplate() As DataTemplate
Public Property PathFigureBindingTemplate() As DataTemplate
Protected Overrides Function SelectTemplateCore(item As Object) As DataTemplate
Dim figure As Object = item.GetType().GetRuntimeProperty("Figure").GetValue(item)
If TypeOf (figure) Is TextFigureBinding Then : Return Me.TextFigureBindingTemplate
ElseIf TypeOf (figure) Is PathFigureBinding Then : Return Me.PathFigureBindingTemplate
Else : Return MyBase.SelectTemplateCore(item)
End If
End Function
End Class

The DataTemplateSelector is included in my Page's Resources as follows:

<ctrl:FigureBindingTemplateSelector x:Key="FBTSelector" TextFigureBindingTemplate="{StaticResource TextFigureBindingTemplate}" PathFigureBindingTemplate="{StaticResource PathFigureBindingTemplate}"/>

And I have an ItemsControl that uses it as follows:

<ItemsControl x:Name="itmCurrFigures" ItemTemplateSelector="{StaticResource FBTSelector}">
<ItemsControl.ItemsPanel><ItemsPanelTemplate><StackPanel/></ItemsPanelTemplate></ItemsControl.ItemsPanel>
</ItemsControl>

However, when I bind the ItemsControl by setting the ItemsSource property, the DataTemplateSelector is never called. I have tried putting a Breakpoint in the DataTemplateSelector, but it is never approached. I know that the binding happens, because my app does display the data I am binding (unformatted, of course, since it is not getting a template). Why is my DataTemplateSelector being ignored? Any help would be appreciated.


Nathan Sokalski njsokalski@hotmail.com http://ift.tt/1itfYLg


DataTemplateSelector not being called

This sample shows how to use DataTemplateSelector mechanism. http://ift.tt/1MTTnHR



DataTemplateSelector not being called

I finally found the answer. You will notice in my code that I override SelectTemplateCore:

Protected Overrides Function SelectTemplateCore(item As Object) As DataTemplate

But the function I was supposed to override was:

Protected Overrides Function SelectTemplateCore(item As Object, container As DependencyObject) As DataTemplate

Notice that the second one has a second parameter, so when I added the following to my selector:

Protected Overrides Function SelectTemplateCore(item As Object, container As DependencyObject) As DataTemplate
Return Me.SelectTemplateCore(item)
End Function

It worked! I thought you could override either one, but I guess not. At least it was a simple fix.



Nathan Sokalski njsokalski@hotmail.com http://ift.tt/1itfYLg


The app didn't start...

I have a fresh Win10 install and a fresh VS2013 U4 install all up to date and I can't seem to start a blank universal app and have the Windows one deploy and run locally. I get:


Activation of the app 6706982d-96d3-4118-bd6d-29ded5761614_w6822g58q152r!App for the Windows.Launch contract failed with error: The app didn't start..


I've refreshed my developer license from within VS. The Windows Phone version boots fine and deploys to the emulator no problem.


Thoughts?






.


Unable to edit or delete data driven subscription - rsInternal Error

I have a data driven subscription that I am trying to edit or delete. If I do either, I get a message






















An internal error occurred on the

report server. See the error log for more details. (rsInternalError) Get Online Help


The status is pending.


Help!


Thank you




I found in a SQL Dmpr0009.log file the following error:


library!ReportServer_0-2!2410!02/27/2015-09:21:38:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: Adding more than one data source with null original name, Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details.;




Unable to edit or delete data driven subscription - rsInternal Error

So what do the log files say?


See if there is any output in Management > SQL Server Logs


Otherwise you may be able to find additional information in the reporting services log file. Its location may be different depending on how it was set up, but here's an example of the file location.


C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles


PowerShell script cannot find user permissions given directly (can find if permissions given in a group) - Please help.

I don't really understand your request. It sounds like you just want to know the permissions per-user



$weburl = "http://dev"
Get-SPUser -web $weburl -Limit All | ?{$_.UserLogin} | select UserLogin, @{name="Url";expression={$_.ParentWeb.Url}}, @{name="Explicit given roles";expression={$_.Roles}}, @{name="Roles given via groups";expression={$_.Groups | %{$_.Roles}}},Groups | Out-String -Width 4096

This will just return all the users and their permissions.



If this is helpful please mark it so. Also if this solved your problem mark as answer.


Raiserror behavior in TRY-CATCH block

Hi Erland,


Indeed, the ; should be also written. Therfore I have added the ; in the code.


Please see the revised code:



BEGIN TRY
BEGIN TRAN
SELECT 1/0; --EXAMPLE
COMMIT TRAN;
END TRY
BEGIN CATCH
ROLLBACK TRAN;
THROW
END CATCH;

Regards,


Reshma




Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered


how to get the data from encrypted file in windows 8

There's not enough information here to help you.


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.


how to get the data from encrypted file in windows 8

Hi ,


how can do convert the encrypted file from decrypt file.


Get the Current Date and Time of a Location

I have created a windowsPhoneApplication in silverLight 8.1.In my application,I have to upload videos on some server.The Uploading get failed If the Date and Time settings of my device is not the current Date and Time.So How can I get the current date and time even if the device settings is wrong?

SSRS - How to do this sort of pivot?

I have following data when I get totals for area, group based on the open close items. The data needs to be reported as a pivot table. Area, groupnames are parameter filters , if they select just grpB, grpA should not be displayed in pivot table. I am not sure how this could be achieved. Can you please give me pointers how to resolve this?




area_name group_nameQuarter openclosed all

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

xx grpA 1 2 35

xx grpB 1 4 26

yy grpA 1 1 12

yy grpb 1 2 13

zz grpA 1 3 14

zz grpb 1 1 12



xx grpA 2 2 24

xx grpB 2 4 15

yy grpA 2 1 12

yy grpb 2 1 12

zz grpA 2 2 24

zz grpb 2 3 15











area_name QuartergrpA grpBtotal

open closeopen close

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





xx 1 23 4 2 11

yy 1 11 2 1 4

zz 1 31 1 1 6

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

grand totals 16 4 7 4 21





xx 2 22 4 1 9

yy 2 11 1 1 4

zz 2 22 3 1 8

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

grand totals 25 5 8 3 21

How to format a link to open in Chrome instead of IE?

Thanks Ganesh for your answer!


I do have a few questions. For your first block of code - is this something I would place inside the HTML source for the webpart? For example, would I place it inside the HTML source for my link library?


For your second block of code - where do I place this?


Thank you!


do not save form when the filed is not completed correctly

Hi


i was create a form and publish in the Document library.


i was create a Repeating Table with two filed(Combo box and text box) and set Action Rule from that filed.This means that the user can not selected same value.


when publish it and full this field and select same value it show me error that set on the Screen Tip but I can save it!!!!!


i want if the form have error any one can not ability to save it.


what am i do?


do not save form when the filed is not completed correctly

You can use views and create a rule to switch the form to a error message..




regards Puran Mishra


do not save form when the filed is not completed correctly

Hi


tanks


but can you mor explain how can do it?


Friday, February 27, 2015

Acces Bloomberg Data with a different serveurhost

Salut salut,


Jespere etre au bon endroit ;). Tout d'abord merci pour votre aide, je suis un peu largée !

En gros, j'ai developpe un .exe en c# qui utilise des donnees bloomberg, cette appli fonctionne tres bien sur mon terminal bloomberg.

Un de mes colleges a tente de lancer l'application depuis son terminmal (car nous artageons le meme drive) et la l'applcation se lance bien mais aucune donnee n'est accessible et tout plante of course!

Perso ja' des bonnes bases en maths finance et c# mais la ca me depasse completement ces histoires de localhost, de droits et tout... je compte sur vous ! ;)


------------------------------La meme en anglais (elargissons l'univers des possibles ) : ------------------------------------------


Hi everyone,


I join the post as I need help and this is one of the closest I found related to my problem.

I am a begginer in Bloomberg request in c#. I recently built an application that worksvery well on my bloomberg terminal. The folder is saved in my folder in a share drive Q: .

I would like to know why the application does not work on the bloomberg terminal of whom who have access to this drive. The application launchs but no data is requested.

Thank you in advance for helping me.


Regarding Network buffer and datareader data fetch c#


i read many write up like how data reader fetch data. here are few links



http://ift.tt/1wrv931
http
://stackoverflow.com/questions/23467482/how-does-sqldatareader-handle-really-large-queries?lq=1
http
://stackoverflow.com/questions/1383920/how-datareader-works
http
://stackoverflow.com/questions/22554158/how-much-data-can-be-stored-in-network-buffer-when-datareader-is-used


people are saying that data reader fetch data in chunk and store in network buffer and display from there. when all data read completed from buffer then again database round trip occur. that why people say data reader is efficient for data reading purpose because it minimize the db round trip but still many things are not clear to me


suppose i issue a sql query like Select empid,Name from employee table there are 10,000 rows then what will happen. how much data sql server will send to client?


suppose network buffer could store 8kb data then sql server may send more than 8kb data or sql server know the client pc network buffer size in advance?


suppose first 100 data is stored in network buffer so when again db trip will occur for next 100 data then same query will executed so how sql server will know that that time sql server has to send data from 101 to 200 etc?


i like to know the above internal process in details regarding interaction between sql server and data reader. so please share the know if some one knows it in details.


one bit different question. how we can determine each row size in byte or kb programmatically by c#. if possible give me direction with sample code. thanks



Regarding Network buffer and datareader data fetch c#

i try to know few simple answer and those are point wise


1) suppose i issue a sql query like Select empid,Name from employee table there are 10,000 rows then what will happen. how much data sql server will send to client?


2) suppose network buffer could store 8kb data then sql server may send more than 8kb data or sql server know the client pc network buffer size in advance?


3) suppose first 100 data is stored in network buffer so when again db trip will occur for next 100 data then same query will executed so how sql server will know that time sql server has to send data from 101 to 200 etc?


i like to know the above internal process in details regarding interaction between sql server and data reader. so please share the knowledge if some one knows it in details.


How is it possible to use Index Seek for LIKE %search-string% case?

Lesha if you add OPTION (RECOMPILE) do you get different plan?


Best Regards,Uri Dimant SQL Server MVP, http://ift.tt/1iQ9JkR



MS SQL optimization: MS SQL Development and Optimization

MS SQL Consulting: Large scale of database and data cleansing

Remote DBA Services: Improves MS SQL Database Performance

SQL Server Integration Services: Business Intelligence


How is it possible to use Index Seek for LIKE %search-string% case?


Lesha if you add OPTION (RECOMPILE) do you get different plan?



Yra, yes, of course. It is because RECOMPILE query hint forces the query optimizer to recompile the query plan each time. So, for:



EXEC dbo.USP_SAMPLE_PROCEDURE N'%94'

the plan includes Index Scan operation which is the ONLY possible way to resolve the query, in my point of view.



PS: I still don't understand how Index Seek can be used to resolve that query.




Alexey



How is it possible to use Index Seek for LIKE %search-string% case?

SQL Server optimizer just uses a cached plan, issue first


DBCC DROPCLEANBUFFERS


go


EXEC dbo.USP_SAMPLE_PROCEDURE N'%94'


And you will CI scan in both executions




Best Regards,Uri Dimant SQL Server MVP, http://ift.tt/1iQ9JkR



MS SQL optimization: MS SQL Development and Optimization

MS SQL Consulting: Large scale of database and data cleansing

Remote DBA Services: Improves MS SQL Database Performance

SQL Server Integration Services: Business Intelligence


How is it possible to use Index Seek for LIKE %search-string% case?

EXEC dbo.USP_SAMPLE_PROCEDURE N'94'





EXEC dbo.USP_SAMPLE_PROCEDURE N'%94'


Lookin at XML plan


<ColumnReference Column="@Beginning" ParameterCompiledValue="N'94'" ParameterRuntimeValue="N'%94'" />




Best Regards,Uri Dimant SQL Server MVP, http://ift.tt/1iQ9JkR



MS SQL optimization: MS SQL Development and Optimization

MS SQL Consulting: Large scale of database and data cleansing

Remote DBA Services: Improves MS SQL Database Performance

SQL Server Integration Services: Business Intelligence


How is it possible to use Index Seek for LIKE %search-string% case?

To be more precise, how Index Seek can be used in case LIKE %search-string% case. I expected that ONLY Index Scan operation can be used here

That is correct, such a an "contains" pattern search an index can't be used by the engine, therefore always an index/table scan is performed.



Olaf Helper


[ Blog] [ Xing] [ MVP]

How is it possible to use Index Seek for LIKE %search-string% case?

Uri suggested the RECOMPILE hint because that would generate the different optimal plans depending on the parameter values provided.

I agree that OPTION (RECOMPILE) solves the issue. Another way of doing this (which seems to me more preferable) is to use OPTIMIZE FOR hint:



IF LEFT(@Beginning, 1) <> '%'
SELECT * FROM HumanResources.Employee
WHERE NationalIDNumber LIKE @Beginning + N'%'
OPTION (OPTIMIZE FOR (@Beginning = N'ZZZZZZZ%'));
ELSE
SELECT * FROM HumanResources.Employee
WHERE NationalIDNumber LIKE @Beginning + N'%'
OPTION (OPTIMIZE FOR (@Beginning = N'%'));



Anyway, this discussion is a little bit beyond the scope of the question because it was not about how to improve the SP - it was exactly what is written in the title and I received a comprehensive answer. Thank you very much.




Alexey


How do I log a XAML bug with the platform team?

Hi - I discovered a bug which I can reproduce with a simple example to do with using images in XAML. The details are buried in another of my posts but I can simplify it if necessary.


The issue is business critical for us and we need something to go on - a workaround, fix or advice so we can decide whether to consider continuing using windows 8.1 apps for our business.


Can someone advise me how I can log a bug or escalate this? Any help at all would be extremely appreciated. Much thanks


How do I log a XAML bug with the platform team?

If you want to report a bug you can post a clear report here and we can file it for investigation for future versions of Windows. Please include full details, repro steps, and the expected and actual behaviour.


If you need help beyond the scope of the forum please open a case at http://ift.tt/1iuXEnN and somebody can work with you directly.


How do I log a XAML bug with the platform team?

Hi Rob - thanks for the response. I have posted some details in another thread of mine but I will create a separate thread just to keep it simple.

The wait operation timed out. (Exception from HRESULT: 0x80070102) when requesting for pushNotification channel

Hi,


I'm getting the exact same issue. Have you found a solution to this?


This code have been working for me in the past months, but now I needed to test again my app and I get a timeout exception:


Channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();


The wait operation timed out. (Exception from HRESULT: 0x80070102)


Please help!


The wait operation timed out. (Exception from HRESULT: 0x80070102) when requesting for pushNotification channel

I really dont know why, but it is working again.


I dont have a solution, and I dont know what Ive changed in my code, but currently it is working without any problems


Conditional formatting and extensibility in Power View for SharePoint 2013 on-premises

Hi Marcelo,


As you know, generally themes , fonts and backgrounds are supportted in power view, more details information:Format Power View reports


Currently, there is no way to extend Power View to support these requirements. I recommend you to submit an wish at http://ift.tt/1aoCsgM


If the suggestion mentioned by customers for many times, the product team may consider to add the feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase the level of service provided.


Thanks for your understanding.


Regards

Vicky Liu




Vicky Liu

TechNet Community Support




SSRS 2008 R2 - COUNTDISTINCT By Group

Hi Unot,


In your senario you can select the entire column(Number) and right click to select the "column visibility" to hide the details column:


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


Regards

Vicky Liu




Vicky Liu

TechNet Community Support




C# compiling error: 'System.Array' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

I'm using VS 2008.


The references are:


System


System.AddIn


System.Data


System.Windows.Forms


System.Xml


and a few SQL Server related references


Raiserror behavior in TRY-CATCH block

I also want to add to Erland above answer, that if you do not want to "SET XACT_ABORT ON" you can use the following format, to have the same result of rolling back al transactions.



BEGIN TRY
BEGIN TRAN
SELECT 1/0 (example tran)
COMMIT TRAN
END TRY
BEGIN CATCH
ROLLBACK TRAN
THROW
END CATCH

This way you will have your Error Handeling in place.


Regards,


Reshma




Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered


Executing Stored Procedure using Command Object

I defined SP in the SQL Server like following.



IF OBJECT_ID('Sales.GetCustomerOrders', 'P') IS NOT NULL
DROP PROC Sales.GetCustomerOrders;
GO

CREATE PROC Sales.GetCustomerOrders
@custid AS INT,
@fromdate AS DATETIME = '19000101',
@todate AS DATETIME = '99991231',
@numrows AS INT OUTPUT
AS
SET NOCOUNT ON;

SELECT orderid, custid, empid, orderdate
FROM Sales.Orders
WHERE custid = @custid
AND orderdate >= @fromdate
AND orderdate < @todate

SET @numrows = @@rowcount;
GO

I want to make client code including SqlCommand, SqlParameter, InputParameter and SqlDataReader.

How to get data and put into List<string>?


Executing Stored Procedure using Command Object

Why do you need to use those entities? Homework?


Anyway, I would rather use some framework to map the stored procedure. In the article linked below you will find an example using Entity Framework. This way you will get a lot of the code for free.


Stored Procedures in the Entity Framework


Executing Stored Procedure using Command Object

Here is link to older topic containing usefull sample.

Executing Stored Procedure using Command Object

Sorry, my question was so ambigous.


Actually I wanted to know how to set multiple input parameter from the client side code.



Executing Stored Procedure using Command Object

The Stored Procedure was verified that has no problem by SSMS.


I made client code that call Stored Procedure like following.



class CustomerOrder
{
string _connString = "Data Source=MyPC\\SQLTEST;Initial Catalog=TSQL2012;User ID=sa;Password=1234567";
public List<string> GetCustomerOrderList(int custid)
{
List<string> orderList = new List<string>();
using (SqlConnection customerOrderConnection = new SqlConnection(_connString))
{
using (SqlCommand customerOrderCommand = new SqlCommand())
{
try
{
customerOrderConnection.Open();
customerOrderCommand.Connection = customerOrderConnection;
customerOrderCommand.CommandText = "GetCustomerOrders";

SqlParameter custidParameter = new SqlParameter();
custidParameter.ParameterName = "@custid";
custidParameter.Direction = ParameterDirection.Input;
custidParameter.SqlDbType = SqlDbType.Int;
custidParameter.Value = custid;
customerOrderCommand.Parameters.Add(custidParameter);

SqlParameter fromdateParameter = new SqlParameter();
fromdateParameter.ParameterName = "@fromdate";
fromdateParameter.Direction = ParameterDirection.Input;
fromdateParameter.SqlDbType = SqlDbType.DateTime;
DateTime dt1 = new DateTime(2007, 01, 01);
fromdateParameter.Value = dt1;
customerOrderCommand.Parameters.Add(fromdateParameter);

SqlParameter todateParameter = new SqlParameter();
todateParameter.ParameterName = "@todate";
todateParameter.Direction = ParameterDirection.Input;
todateParameter.SqlDbType = SqlDbType.DateTime;
DateTime dt2 = new DateTime(2008, 01, 01);
todateParameter.Value = dt2;
customerOrderCommand.Parameters.Add(todateParameter);

SqlParameter outputParameter = customerOrderCommand.Parameters.Add("@numrows", SqlDbType.Int);
outputParameter.Direction = ParameterDirection.Output;
customerOrderCommand.CommandType = CommandType.StoredProcedure;
using (SqlDataReader customerOrderDataReader = customerOrderCommand.ExecuteReader())
{
while (customerOrderDataReader.Read())
{
orderList.Add(customerOrderDataReader.GetString(0));
}
}
return orderList;
}
catch (SqlException ex)
{
throw ex;
}
}
}
}
}
class Program
{
static void Main(string[] args)
{
CustomerOrder co = new CustomerOrder();
foreach (string order in co.GetCustomerOrderList(1))
{
Console.WriteLine("{0}", order);
}
}
}

If run, following error occurs.


Could not find Stored Procedure "GetCustomerOrders"....


Can you help me to fix this code?



How to change crystal report data field at runtime ?

Firstly thanks for replay me.


From your above ideas i understand that you are telling to alter my column data type decimal to string, yes it will work properly if we only displaying the data in crystal report,but in my crystal report i am doing an addition operation over those decimal data and showing total quantity in decimal,so if i change it to decimal then the addition operation not work,is their any other way to overcome this ?


if their please tell me..




S.K Nayak


Search and replace string inside a column


Update yourtable
Set ColumnA = Replace(ColumnA,'_TH','');





Search and replace string inside a column

Do like this



declare @str nvarchar(40)
set @str='Test_TH'

select replace(@str,'_TH','')





Many Thanks & Best Regards, Hua Min


jquery plugins with sharepoint 2010

hi,


Where have you put the jquery refrence?


the below url could help you with jquery and sharepoint.


http://ift.tt/1rIdCLs


Let me know if this help.


Thanks


Bhism


Search and replace string inside a column

Hi,


in my table there is Column A with Type NVARCHAR.


i need to search inside all the rows in that column to find the string "_TH" and remove it wherever it exist.


how can i do it?


Spreading Amount across financial year based on Start and End Date

Jaggy, we have answered many questions for your previously. Each time you have been asked to provide example data in a table, ready for us to use. You have never done this.


I'll gladly take a look at your problem, but I am not going to do this step for you any more. Provide us the data as a table.


Spreading Amount across financial year based on Start and End Date

Would have been better if you'd put it in a code block (second button from the right in the editor) but at least you posted it!



DECLARE @table TABLE (PropCode INT ,PropStartDate DATE ,PropEndDate char(10) ,PropRentStartDate DATE ,PropRentEndDate DATE ,MarketRent INT)
INSERT INTO @table(PropCode, PropStartDate, PropEndDate, PropRentStartDate, PropRentEndDate, MarketRent) VALUES
(2718, '2013-01-30','NULL','2012-11-29','2013-07-21',289.20),(2718, '2013-01-30','NULL','2013-07-22','2013-11-24',289.20),
(2718, '2013-01-30','NULL','2013-11-25','2014-06-14',289.20),(2718, '2013-01-30','NULL','2014-06-15','2014-11-30',299.18),
(2718, '2013-01-30','NULL','2014-12-01','2015-01-02',299.18),(2718, '2013-01-30','NULL','2015-01-03','2050-01-01',310.00),
(3901, '2014-05-27','NULL','2014-06-09','2014-11-30',400.00),(3901, '2014-05-27','NULL','2014-12-01','2050-01-01',400.00),
(3960, '2014-10-31','NULL','2014-11-05','2016-11-05',470.00)


DECLARE @rentDate DATETIME = '2014-08-01'

SELECT *
FROM @table
WHERE @rentDate BETWEEN propRentStartDate AND propRentEndDate

SET @rentDate = '2015-03-01'
SELECT *
FROM @table
WHERE @rentDate BETWEEN propRentStartDate AND propRentEndDate



My solution is much different than Eric's, but I said if you posted the ddl and example data I'd take a look, so here it is!




Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.


Spreading Amount across financial year based on Start and End Date

Hi Eric,


View one is the query output that I'm trying to achieve so we are able to search the Market Rent Value per month.


Regards,


Jag


jquery plugins with sharepoint 2010

hi,


refer the below articles to achieve what you want


http://ift.tt/1rIdCLs


http://ift.tt/1BID5z0




Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer


Thursday, February 26, 2015

Sqlserver 2012 Cache Hit Ratio

I concur with Shanky. Instead of BCHR, use Page Life Expectancy to check for memory pressure


Satish Kartan www.sqlfood.com


generate report of all site content page in sharepoint 2010

Hi,


I have a requirement like I need to generate a dashboard kind of report of all site content page in sharepoint.How many ways to achieve this in sharepoint 2001.Can u please help.


Regards,


Praveen


c# AUTOCOMPLETE TEXTBOX PROBLEM SPECIFIED CAST NOT VALID

Whenever i use a function for autocomplete in textbox it works in other windows, but when i use that function in mdi child window it shows following error:-


Specified cast not valid.


c# AUTOCOMPLETE TEXTBOX PROBLEM SPECIFIED CAST NOT VALID

Hi


>>but when i use that function in mdi child window


What do you mean about "mdi child window"?


Best 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.


Help with TSQL please.

Is it the below query that you are looking for ?



SELECT distinct a.loginname
,a.dbname
,a.dbrole
,b.serverrole
FROM DBUser AS a
JOIN ServerRole AS b
ON a.loginname = b.loginname;
GO





Regards, RSingh


Help with TSQL please.

No, the results I am looking for is return unique data in Server Role.

Sqlserver 2012 Cache Hit Ratio

Hi,


I am not sure how you are calculating BCHR but below query would give you correct value,Source



SELECT cast((CAST(A.cntr_value1 AS NUMERIC) / CAST(B.cntr_value2 AS NUMERIC))*100 as decimal(10,2)) AS Buffer_Cache_Hit_Ratio

FROM (

SELECT cntr_value AS cntr_value1

FROM sys.dm_os_performance_counters

WHERE object_name = 'SQLServer:Buffer Manager'

AND counter_name = 'Buffer cache hit ratio'

) AS A,

(

SELECT cntr_value AS cntr_value2

FROM sys.dm_os_performance_counters

WHERE object_name = 'SQLServer:Buffer Manager'

AND counter_name = 'Buffer cache hit ratio base'

) AS B



if you read the article by Jonathan it clearly says don't rely on BCHR for gauging memory pressure




Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it



My Technet Wiki Article


MVP



Is it possible to add Event Handler in separate ResourceDictionary directly?

check this code sample command binding in DataTemplate. http://ift.tt/1E2j7zq

calculated fields in ssrs

Hi Sam,


I have tried to implement as you have mentioned. I got the error while using LookupSet function.


please try to use LOOKUP function instead of Lookupset.


Hope it will resolve.


Thanks


Prasad



My Website : http://msbitips.com
My Blog :http://ift.tt/1AA7M5A

calculated fields in ssrs

Hi Prasad,


Thanks for the response.Initially i have tried with LOOKUP only since i have combined all the matched columns into one but got the same error later i have tried with LOOKUPSET..


Thanks,


Sam.


calculated fields in ssrs

Hi Sam,


I have copied the RDL code , please copy and save as .RDL file. Using Lookup I did this.


In my implementaion if is not matching with your requirement, kindly let me know.



<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://ift.tt/1eyg007; xmlns:rd="http://ift.tt/1hjf1WD;
<Body>
<ReportItems>
<Tablix Name="table1">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.22in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="textbox2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>ID</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>fruit</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox5">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Fruit Name</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.21in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="id">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!id.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>id</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="fruit11">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!fruit1.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>fruit11</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="FruitName11">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!FruitName1.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>FruitName11</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
<RepeatOnNewPage>true</RepeatOnNewPage>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<Group Name="table1_Details_Group">
<DataElementName>Detail</DataElementName>
</Group>
<TablixMembers>
<TablixMember />
</TablixMembers>
<DataElementName>Detail_Collection</DataElementName>
<DataElementOutput>Output</DataElementOutput>
<KeepTogether>true</KeepTogether>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSet1</DataSetName>
<Top>0.36in</Top>
<Height>0.43in</Height>
<Width>3in</Width>
<Style />
</Tablix>
<Textbox Name="textbox1">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>LookupSet</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>20pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>SteelBlue</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox1</rd:DefaultName>
<Height>0.36in</Height>
<Width>5in</Width>
<ZIndex>1</ZIndex>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Tablix Name="table2">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.22in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="textbox3">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>ID</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox2</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox4">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>fruit</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox3</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Textbox6">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Fruit Name</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>11pt</FontSize>
<FontWeight>Bold</FontWeight>
<Color>White</Color>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox5</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>SteelBlue</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.21in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="id2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!id.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>id</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="fruit2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!fruit.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>fruit</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="FruitName2">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Join.Value</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>FruitName</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
<TablixMember />
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
<RepeatOnNewPage>true</RepeatOnNewPage>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<Group Name="table1_Details_Group2">
<DataElementName>Detail</DataElementName>
</Group>
<TablixMembers>
<TablixMember />
</TablixMembers>
<DataElementName>Detail_Collection</DataElementName>
<DataElementOutput>Output</DataElementOutput>
<KeepTogether>true</KeepTogether>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSet2</DataSetName>
<Top>1.11229in</Top>
<Height>0.43in</Height>
<Width>3in</Width>
<ZIndex>2</ZIndex>
<Style />
</Tablix>
<Tablix Name="Tablix2">
<TablixBody>
<TablixColumns>
<TablixColumn>
<Width>1in</Width>
</TablixColumn>
</TablixColumns>
<TablixRows>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox19">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Amount</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox19</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="Textbox20">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Lookup(Fields!FruitName1.Value,Fields!Join.Value,Fields!amount.Value, "DataSet2")</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox20</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</CellContents>
</TablixCell>
</TablixCells>
</TablixRow>
</TablixRows>
</TablixBody>
<TablixColumnHierarchy>
<TablixMembers>
<TablixMember />
</TablixMembers>
</TablixColumnHierarchy>
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="Details" />
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
<DataSetName>DataSet1</DataSetName>
<Top>1.93625in</Top>
<Left>0.16542in</Left>
<Height>0.5in</Height>
<Width>1in</Width>
<ZIndex>3</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Tablix>
</ReportItems>
<Height>3.05042in</Height>
<Style />
</Body>
<Width>5.16542in</Width>
<Page>
<LeftMargin>1in</LeftMargin>
<RightMargin>1in</RightMargin>
<TopMargin>1in</TopMargin>
<BottomMargin>1in</BottomMargin>
<Style />
</Page>
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="AdventureWorks2008R2">
<DataSourceReference>AdventureWorks2008R2</DataSourceReference>
<rd:SecurityType>None</rd:SecurityType>
<rd:DataSourceID>830bec66-3eef-4c84-b26b-69b2843906ca</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>AdventureWorks2008R2</DataSourceName>
<QueryParameters>
<QueryParameter Name="@Fruit">
<Value>=Parameters!Fruit.Value</Value>
</QueryParameter>
</QueryParameters>
<CommandText>select * from
(
Select 1 id , 'Apple' fruit
union
Select 2 id , 'Mango' fruit
union
Select 3 id , 'Grapes' fruit
) t
where id =@Fruit</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
<Fields>
<Field Name="id">
<DataField>id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="fruit1">
<DataField>fruit</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="FruitName1">
<Value>=Parameters!Fruit.Value +"||"+Parameters!FruitName.Value +"||" +Parameters!abc.Value</Value>
</Field>
</Fields>
</DataSet>
<DataSet Name="DataSet2">
<Query>
<DataSourceName>AdventureWorks2008R2</DataSourceName>
<QueryParameters>
<QueryParameter Name="@Fruit">
<Value>=Parameters!Fruit.Value</Value>
</QueryParameter>
</QueryParameters>
<CommandText>select * from
(
Select 1 id , 'Apple' fruit ,1000 amount
) t
where id =@Fruit</CommandText>
</Query>
<Fields>
<Field Name="id">
<DataField>id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="fruit">
<DataField>fruit</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="amount">
<DataField>amount</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="Join">
<Value>=Parameters!Fruit.Value +"||"+Parameters!FruitName.Value+"||" +Parameters!abc.Value</Value>
</Field>
</Fields>
</DataSet>
</DataSets>
<ReportParameters>
<ReportParameter Name="Fruit">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>1</Value>
</Values>
</DefaultValue>
<Prompt>Fruit</Prompt>
</ReportParameter>
<ReportParameter Name="FruitName">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>=now()</Value>
</Values>
</DefaultValue>
<Prompt>FruitName</Prompt>
</ReportParameter>
<ReportParameter Name="abc">
<DataType>DateTime</DataType>
<DefaultValue>
<Values>
<Value>=now()</Value>
</Values>
</DefaultValue>
<Prompt>abc</Prompt>
</ReportParameter>
</ReportParameters>
<Language>en-US</Language>
<ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
<rd:ReportUnitType>Inch</rd:ReportUnitType>
<rd:ReportID>c87d19dd-1be9-4dc4-9237-63d06aa7a91a</rd:ReportID>
</Report>