Wednesday, April 30, 2014

HTTP POST code works on an online compiler but not on a pc

Hmmm....on second thought, I guess this post has more to do with networking and little to do with C#. I will transfer this post to the appropriate forum.

Lookup value not getting populated...

I am using following xml code (copy.asmx > method CopyIntoItems). Per Microsoft http://ift.tt/1iKTXtR I should be able to update lookup fields value as well because Lookup list is on the same subsite and both source and target libraries are on the same sub-site as well. Any idea? Item gets copies and all the columns get populated except the lookup column. I verified that the ID and value matches for the lookup value.



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://ift.tt/Atvu06; xmlns:soap="http://ift.tt/1hg4FE6; xmlns:m="http://ift.tt/1aeOdzg;>
<soap:Header>
</soap:Header>
<soap:Body>
<m:CopyIntoItems>
<m:SourceUrl>http://http://ift.tt/R2yGkA</m:SourceUrl>
<m:DestinationUrls>
<m:string>http://http://ift.tt/1hg4FEa</m:string>
</m:DestinationUrls>
<m:Fields>
<m:FieldInformation Type="Text" DisplayName="Sales Code" InternalName="SalesID" Value="99999"></m:FieldInformation>
<m:FieldInformation Type="Text" DisplayName="Sales Person Name" InternalName="FullName" Value="TEST, John S."></m:FieldInformation>
<m:FieldInformation Type="Choice" DisplayName="FileSection" InternalName="PersonnelFileSection" Value="1- New Hire Paperwork, ECA, Termination, LOA"></m:FieldInformation>
<m:FieldInformation Type="Choice" DisplayName="FileCategory" InternalName="PersonnelFileCategory" Value="Termination Paperwork"></m:FieldInformation>
<m:FieldInformation Type="Text" DisplayName="Year" InternalName="Record_x0020_Year" Value="2014"></m:FieldInformation>
<m:FieldInformation Type="DateTime" DisplayName="Effective Date" InternalName="Anniversary" Value="04/22/2014 00:00:00"> </m:FieldInformation>
<m:FieldInformation Type="Choice" DisplayName="Status" InternalName="Current_x0020_Status" Value="Terminated"></m:FieldInformation>
<m:FieldInformation Type="Lookup" DisplayName="AreaCode" InternalName="AreaCode" Id="cdae6ca0-d49c-4971-a580-2adcd7a282f1" Value="4;#1795004"></m:FieldInformation>
<m:FieldInformation Type="Text" DisplayName="Title" InternalName="Title" Value="TEST"></m:FieldInformation>
</m:Fields>
<m:Stream>base64Binary</m:Stream>
</m:CopyIntoItems>
</soap:Body>
</soap:Envelope>



Lookup value not getting populated...

How many values are pulled in the lookup column?


Also thourgh UI are you able to see values for the lookup column.




Please ensure that you mark a question as Answered once you receive a satisfactory response.


MDI parent and child help

HI, to say i am new to programming is an understatement, but i am clicking and trying various possibilities to get my MDIparent form to work correctly (or as i need).


So far i have managed to build the MDIparent with a ToolStrip and a few child forms. I have even managed to get the child forms to display within the parent. My problem is that i only require 1 child at any one time. If i hit the same button again it creates a new instance of the same form and if i hit another button it will open the new form.


If anyone knows how i can get a button to check and close other forms before opening the new one it would be a great help. Also preventing multiple instance of the same form would help to.


I have gone over a multitude of code examples and snippets and my brain is starting to get clogged up with info.


Please try and explain as basically as possible.


Thanks in advance



Any Simplest example of Abstraction in C#?

error in pivot statement in sqlserver

Thank you very much dear friend.it's working fine now

Traffic Data Report

Hello All


I have a question about displaying multiple Values within ONE bar (horizontal preferred).


The requirement is as followed:


We have a timeline (horizontal) which measures 24 houres.


We have data (values: 1 green,2 yellow,3 red) which correspond with the traffic load, also as horizontal bar.


Now the problem is, what diagram covers this report?


At the end the should be a horizontal bar showing from 00:00 o'click to 23;59 o'Clock, ever minute, the status of traffic load. green, yellow, or red.


As far as i have seen, there is no bar in the report server builder. am i right? and when yes, were to find such like this?


regards


Vienna


An unexpected error occurred in Report Processing. (rsInternalError)

Hi,


1. Are you using the NLB? If possible, please turn off the NLB temporally to see whether the is gone.


2. Try to enlarge the execution timeout value in the web.config.


a. Backup the web.config first. Then, open the web.config from the report server folder, located at c:\Program Files\Microsoft SQL Server\MSRS11.<instance name>\Reporting Services\ReportServer\ by default.


b. Find out the following line in the file.


<httpRuntime executionTimeout="9000" />


c. Modify the attribute value from 9000 to 36000. Save the web.config file and restart the reporting service.


3. Restart the reporting service and then you need reproduce this issue, and collect the new reporting service logs.


Thanks.




Tracy Cai

TechNet Community Support



Manage meta data service is not creating in share point server 2010

When i trying to create manage meta data service then i am not able to create mms and getting this error :-The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator. Please help me .....



Incomplete results when using FullTextSqlQuery and NULL predicate

Hi,


Please try to use the following query text.


(CONTAINS(PlacesId, 'a2ce9dd7-f801-4403-affb-1944bf253255') OR (PlacesId > ''))

Here are two materials for you to take a look at:

http://ift.tt/1pR9ahB


http://ift.tt/R5Ke6h


Thanks,

Dennis Guo

TechNet Community Support

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




Dennis Guo

TechNet Community Support



Sharepoint 2010 folders moved to another location lost the properties of the items

Hi,


In sarepoint 2010, a folder from a document library is moved from one location to another location ad it lost the properties of each item. How do i restore the properties for each item in the folder.


Any help is much appreciated.


Thanks in Advance.




Smile Always


Sharepoint 2010 folders moved to another location lost the properties of the items

It is probably not going to be possible to recover that data if it has been removed but it may be possible if you can give us more complete details on where it was moved from and to, as well as how it was moved.

Print ByteArray Issue

I guess I miss something when it comes to printing files. I read all bytes out of a png image and send them to printer's job stream. However I get bytes printed out and not the image itself. I know its funny. How do I create proper print format?


This is the link containing code I am using:


http://ift.tt/1kgXzkM


Print ByteArray Issue

Every file stored in a computer is a binary file, only the format/structure of the file makes different programs recognize whether the file is compatible with the program or not. If you read the bytes and print, it will print bytes, but you need to tell printer about the structure/format .


Check with the solution here


http://ift.tt/S93KzS




Mark Answered, if it solves your question and Vote if you found it helpful.

Rohit Arora


Print ByteArray Issue

@Rohit


Yeah I figured I need to tell printer about the structure.


Thanks for that link


I have to admit I found that code already. It does a good job.


However what about other file formats such such as .docx, .xlsx, .txt? e.Graphics.Draw(...) won't work there.


Any idea how to print "any" file?


Print ByteArray Issue

Thanks Anne,


I have to admit I tried that approach already out and it works for docx documents but not for jpg files.


For whatever reason the print command gets stuck when trying to send image to printer. Any ideas what I could do to solve this?


No matter if I call print in commander or Process.Start(...) from C# app gets stuck when a image is to be printer


Prevent C# console from closing on exception


i would like to check if there is a way to stop the console from closing when there is a exception?





This should work:



static void Main(string[] args)
{
try
{
// put all code in here ...


try
{
File.Open("Not An Existing File", FileMode.Open); // test an exception
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}



}
finally
{
Console.Write("Press Enter to close window ...");
Console.Read();
}
}

- Wayne


Prevent C# console from closing on exception

hi.. thanks for all the respond... sorry that i forget to mention that the console application is suppose to be fully automated once deploy.. is there anywat for it to loop back to preform its normal task?


Invalid column name

Thank you

How to update records with alphanumeric increment values?

As suggested above, you can generate the new ID-s with ROW_NUMBER():


http://ift.tt/1hU62HW





Kalman Toth Database & OLAP Architect Free T-SQL Scripts

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012


How to update records with alphanumeric increment values?

As everyone have suggested ROW_NUMBER() would help you in your requirement.


But my suggestion is that you create a Dimension(Master) table which have all the AD domain names. You can have a primary key in this table and then you can reference this key in your actual table. This way search on primary key of this table would be faster as it'll be only integer.




Chaos isn’t a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some are given a chance to climb, but they refuse. They cling to the realm, or the gods, or love. Illusions. Only the ladder is real. The climb is all there is.


How to create a zip file in winrt app in local storage?

I am working in winrt app. I have a database and two folders in Local storage. I want to zip this database and folders together and want to save zip file in any local drives.


Can any one tell me how I can achieve this ?


How to get font size of the pdf document


Hi friend how do i get the font size of the pdf document


WACK Failed: The binary .exe is built in debug mode

Hi Ken,


In the documentation, it said how to fix: Please make sure the app isn’t linking to any debug versions of a framework, and it is built with release configuration. If this is a managed app please make sure you have installed the correct version of .NET framework.


So you have to validate at least three things:


1, Your app did not ref to debug version of framework.


2, Set the app debug configuration setting as "release"


3, If you are working with Windows RT, you should use RT version of WACK.


If the problem still exist, plz feedback to me.


Thanks.


--James




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

Thanks

MSDN Community Support



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



WACK Failed: The binary .exe is built in debug mode

Thanks James,


I have checked the following:-


Your app did not ref to debug version of framework : Using the same code base I have successfully deployed my application to the store for the x86 and x64 platforms.


Set the app debug configuration setting as "release" : I have set the configuration to "release" for build and package creation ('ARM | Release').


If you are working with Windows RT, you should use RT version of WACK: I have uninstalled and reinstalled WACK for RT.


I'm still getting the same WACK failure. Is there any more information I can provide you with?


Ken


Expression for calculating number of machines between values


If I wanted to use the avg value for Value in your statement, where would I put the statement saying AVG(Value) AS avg_value?



do you mean this?



SELECT SUM(Tot)/SUM(Cnt)
FROM
(
SELECT Computer,SUM(Value) AS Tot,COUNT(*) AS Cnt,
MAX(CASE WHEN Value > 80 THEN 2 WHEN Value BETWEEN 70 AND 80 THEN 1 ELSE 0 END) AS Flag
FROM Table
GROUP BY Computer
)t
WHERE Flag = 1





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


Multiple Undos for data grid view table

Hi Purpledidino,


mUndoDataTables.Count was a method, try to use Count().


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.


Multiple Undos for data grid view table

How should I do that ?

Prevent C# console from closing on exception

I think that the only way you can achieve it is to put some try-catch blocks around your code, each one give back the precise info about the raised exception.


Than in main() you put a nother try-catch block to intercept the top-level raised exception and, i.e. write in the console output.


Note that with this solution the console won't close, but won't work anymore since a restart.




Davide 'n3wt0n' Benvegnù



If you found my answer helpful, please vote it.

If you think that my answer resolve your issue, plase "Mark it as answer".


Help in Complex query

Please help on this update.

Help in Complex query

Please help on this update query.

Help in Complex query

Can you try the below




DECLARE @MyVariable int;
Select @MyVariable=MAX(code_t1) from #T1
DECLARE @rownum int=0
DECLARE @id int;
Declare @code_desc varchar(10)='0334'

DECLARE upd_cursor CURSOR
FOR SELECT code_t1 FROM #t1

OPEN upd_cursor
FETCH NEXT FROM upd_cursor
INTO @id
WHILE @@FETCH_STATUS = 0
BEGIN
set @rownum=@rownum+1
UPDATE #t1
set code_t1 = (@MyVariable)+@rownum,
code_t1_desc=replace(code_t1_desc,SUBSTRING(code_t1_desc,0,CHARINDEX('_',code_t1_desc)),@code_desc)
where code_t1=@id
FETCH NEXT FROM upd_cursor
INTO @id

END
CLOSE upd_cursor;
DEALLOCATE upd_cursor;

select * from #t1









For the first part answer,Please modify the second part accordingly.


--Prashanth



Help in Complex query

Hi, Result of first part (#t1) is OK. Can you please also help on the other 2nd part's update query. I'll be much appreciated for your help. Thanks.


Sub select query Help

I have to do a task of finding records which matches the following logic.


My table has PID varchar(15), Amount varchar (50),Status varchar(20) columns.


Each PID can go thru changes in a period of time, in my case i dont have a data range I just have a flatfile which consists of three types of PID`s


123456 = Original_PID, Reversal =123456R1,Adjustment= 123456A1.


Basically What I am trying to find out if there are any original PID`s which has a Reversal or an Adjustment.


here`s the code I have started on... Can someone help me get it finished?



select R1. pid,a1.pid,org.pid from (



select SUBSTRING(Pid,1,11)as Original_PID, status, paid_amount as Amount from dbo.Q2STATUS)org

inner join (select SUBSTRING(Pid,1,13)as Original_Icn,status,paid_amount from dbo.Q2STATUS
where SUBSTRING(Pid,12,2) ='R1')r1 on r1.pid=org.pid

inner join (select SUBSTRING(claim_id,1,13)as Original_Icn,status,paid_amount from dbo.Q2STATUS
where SUBSTRING(Pid,12,2) ='A1')A1 on a1.Pid=org.PID





FM


Sub select query Help

Hi,


Please check following item


It uses a SQL string function, please create it first



/*
create table Q2STATUS (Pid nvarchar(200), Status varchar(20), paid_amount int)
insert into Q2STATUS select '123456 = Original_PID, Reversal =123456R1, Adjustment= 123456A1',NULL,250
*/

with cte2 as (
select rn = row_number() over (order by pid), * from Q2STATUS
), cte as (
select cte2.*, s.id typeid, v.*
from cte2
cross apply dbo.split(cte2.Pid, ',') s
cross apply dbo.split(s.val, '=') v
), cte3 as (
select
rn, pid, status, paid_amount, max(pidtype) pidtype, max(pidval) pidval
from (
select
rn, Pid, status, paid_amount, typeid,
case when (typeid = 1 and id = 2) or (typeid <> 1 and id = 1) then ltrim(rtrim(val)) else null end as pidtype,
case when (typeid = 1 and id = 1) or (typeid <> 1 and id = 2) then ltrim(rtrim(val)) else null end as pidval
from cte
) g
group by rn, pid, status, paid_amount, typeid
)
select
cte2.rn, cte2.pid,
cte3.pidval as 'Original_PID',
cte4.pidval as 'Reversal',
cte5.pidval as 'Adjustment'
from cte2
left join cte3 on cte3.rn = cte2.rn and pidtype = 'Original_PID'
left join cte3 as cte4 on cte4.rn = cte2.rn and cte4.pidtype = 'Reversal'
left join cte3 as cte5 on cte5.rn = cte2.rn and cte5.pidtype = 'Adjustment'





SQL Server, SQL Server 2012 Denali and T-SQL Tutorials


how to check that item is editing or uploading?

Hello


I want to identify that item is editing or uploading in itemupdated event, how can i validate this?


Regards


Avi


how to check that item is editing or uploading?

Hello Avi,


As per my understanding you want to identify the synchronous event. Please use ItemUpdating instead of ItemUpdated to capture the event. Here is list of all events:


http://ift.tt/1fwKZAK


Correct me if i misunderstood you and provide more detail about requirement.




Hemendra:Yesterday is just a memory,Tomorrow we may never see

Please remember to mark the replies as answers if they help and unmark them if they provide no help


Tuesday, April 29, 2014

How to run copy command using command line in c# ?

Hi,


I just want to copy a file from one location to other. How should i do it using c#, i want to use the command line commands to do that ?


I have this code that doesn't work :



string command = "copy hello.txt hello4.txt";

System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);

procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();

string result = proc.StandardOutput.ReadToEnd();

Console.WriteLine(result);



Please help..!!


How to run copy command using command line in c# ?

Hi, you can use File.Copy to copy file, it is easy, document and example here:


http://ift.tt/1iAyPGG


How to run copy command using command line in c# ?

yes, the command need to be run from command prompt programaticaly but couldnt find the correct method to do that. I have mentioned the code i did in the first post. but it is not working.


Please let me know what is wrong in it.


Thanks..


How to run copy command using command line in c# ?

Hi,


Please try some codes below:



System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C copy /a D:\\doc1.txt + D:\\doc2.txt D:\\doc3.txt";
process.StartInfo = startInfo;
process.Start();

Best Wishes!



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. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


Remove http:// in C# Windows Application

Here are a couple of alternatives

var str = "http://ift.tt/1flBr5D;;
var str1 = str.Substring(7);
var str2 = str.Split(new [] {"//"}, StringSplitOptions.None)[1];


How to use NVelocity for message template using console or windows application

Hi,


I am new into the creating message template using nvelocity. I have done sample message template using razor engine. But i want to do same manner in nvelocity. Please help me out. Thanks.


How to use NVelocity for message template using console or windows application

Hi,


According to your question, I am afraid your problem is out of support in C# forum. Because the NVelocity is the 3th part product. But there are some useful links you can refer to:


http://ift.tt/R1njck


http://ift.tt/R1ni85


For more information about NVelocity you can go to the link below to post your problem:


http://ift.tt/R1ni89


Best Wishes!




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. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


Subscribed SSRS 2012 report fails to execute when not using default parameters

Our configuration is using SSRS 2012 integrated with SharePoint 2010.


When a user subscribes to a report and selects the default parameters, the subscription runs just fine. However, if the user selects a parameter, other than default, the report fails with the following error message:


The report server has encountered a configuration error. Logon failed for the unattended execution account.”


Note the logon failed part of it. It is using the exact same execution account, so why would SharePoint (SSRS) be reporting a Logon Failed?


Has anyone run into this situation and if so, please help us get out of it, I’ve got a bunch of irate users – I hate irate users.


Appreciate the help – Thanks in advance.




Thanks Ron...


Subscribed SSRS 2012 report fails to execute when not using default parameters

Hi Ron,


Generally, the error message means that on the report server, there is an unattended execution account specified and most likely the password expired. We always set the Unattended Execution Account if we don't want to set credentials for data sources and want the data source to work even when users are not able to enter their credentials (subscriptions or other scheduled executions.)


In your scenario, I guess the parameter may be related to the unattended execution account. We can check the parameter default value and other available values to troubleshoot this issue.


References:

Configure the Unattended Execution Account

User permission on the reporting service database server


Hope this helps.


Thanks,

Katherine Xiong




Katherine Xiong

TechNet Community Support



Prevent C# console from closing on exception

Hi,


i am writing a console timer job to send automated email. every has being successfully.. but for any code, there might be some exception being surface due to unforeseen circumstances. therefore i would like to check if there is a way to stop the console from closing when there is a exception?


byzantine hoops of microsoft software configurations?????????

I just bought sql server 2012 developer edition to try and learn about ssas,ssis,ssrs at home. cannot afford vs professional,so tried downloads to get sql server data tools.


but vs2013 data tools download currently unavailable , so tried ssdt vs2012 download.


still cannot see data tools under analysis services in sql server 2012.


HOW DO I PROCEED ON THIS AND WHY IS IT SUCH A BYZANTINE PROCESSS????????????


byzantine hoops of microsoft software configurations?????????

Hello,


In my opinion, this thread is related to SQL Server forum. So please post thread on that forum for more effective response. Thank you for understanding. Please refer to the following link. http://ift.tt/1gO6Rnb.


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.


Need to generate a custom footer in one data file by a client running sqlcmd.

Hi Anurag,


After running the command, we can see the newout.txt and testout.txt:


===================================================================================================




Note: The latest result that run the script is in the newout.txt, and after the ‘copy’command, testout.txt is the final results.



If there's any questions, please do not hesitate to contact us.


Crash management for in-house application

hello,


i am trying to develop an in-house store app and as last step i am trying to implement crash management system. is there any system like acra in android? or can i handle crashes without using third party? i know windows creates a file about application crash(stack trace vs.) how can i get this file and send via web service? what is the best solution?


thanks for your helps in advance,


Crash management for in-house application

there are many logging frameworks out there. please review them & select one that best meets your requirements.


also, you can roll out your own as well - have try catch blocks & log + send email with exception details in the catch block.


hope this helps!


Crash management for in-house application

hi Shreeharsh,


thanks for your reply. i prefer handling it if i can. you said try-catch block but we are talking about crashes, is it possible to catch crashes in catch block? i mean does windows give us a chance to run some code when application crashes? if so which file should i use to catch all crashes in my application?


there is also another problem sending log via email. what if there is no connection?


Crash management for in-house application

hi Anne,


thanks for your reply, i will check the links you wrote. i have a question about store dashboard. as i mentioned i am developing an in-house app, i am not distributing it on store but installing manually(i will use a client management system like radia) in this situation, will dashboard give me the info that i need?


Using a ComboBox in a Grid DataTemplate with a CollectionViewSource to provide the ItemsSource

Hi,


You cannot do it above. Because the combobox binding to a same source, so if you change one Item on a Record, it changes all of them. You can edit your code like below:



<Page
x:Class="comboboxtest.MainPage"
xmlns="http://ift.tt/w9rHWX;
xmlns:x="http://ift.tt/zZkFEV;
xmlns:local="using:comboboxtest"
xmlns:d="http://ift.tt/PuXO1J;
xmlns:mc="http://ift.tt/R4RR6u;
mc:Ignorable="d">
<Page.Resources>
<!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
<x:String x:Key="AppName">My Application</x:String>



</Page.Resources>

<!--
This grid acts as a root panel for the page that defines two rows:
* Row 0 contains the back button and page title
* Row 1 contains the rest of the page layout
-->
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>
<TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
</Grid>
<ScrollViewer Grid.Row="1" Margin="25, 0, 0, 0" HorizontalScrollBarVisibility="Auto" >
<StackPanel>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="110" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.ColumnSpan="5">
<TextBlock Text="Items" Style="{StaticResource SubheaderTextBlockStyle}" TextAlignment="Center"/>
</StackPanel>
<Border Grid.Column="0" Grid.Row="1">
<TextBlock Text="Room/Category" Style="{StaticResource BodyTextBlockStyle}" />
</Border>
<Border Grid.Column="1" Grid.Row="1">
<TextBlock Text="Square Feet" Style="{StaticResource BodyTextBlockStyle}" />
</Border>
<Border Grid.Column="2" Grid.Row="1">
<TextBlock Text="Note" Style="{StaticResource BodyTextBlockStyle}" />
</Border>
</Grid>
<ItemsControl Name="ItemGrid" Foreground="{ThemeResource ApplicationForegroundThemeBrush}" >

<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300" />
<ColumnDefinition Width="110" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ComboBox x:Name="cboCategory" Grid.Column="0"
ItemsSource="{Binding Categories}" SelectedIndex="{Binding selectIndex}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name }"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBox Grid.Column="1" Text="{Binding Area, Mode=TwoWay}" InputScope="Number" />
<TextBox Grid.Column="3" Text="{Binding Note, Mode=TwoWay}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<AppBarButton Label="Add" Icon="Add" Click="AddItem_Click" />
</StackPanel>
</ScrollViewer>

</Grid>

</Page>


namespace comboboxtest
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
///
class Category
{
public Category(string Name, string Area)
{
this.Name = Name;
this.Area = Area;
}

public string Name { get; set; }
public string Area { get; set; }
}

class Item
{
public Item(int selectIndex, ObservableCollection<Category> Categories, string Area, string Note)
{
this.Categories = Categories;
this.Area = Area;
this.Note = Note;
this.selectIndex = selectIndex;
}
public ObservableCollection<Category> Categories { get; set; }
public int selectIndex{get;set;}
public string Area { get; set; }
public string Note { get; set; }
}

public sealed partial class MainPage : Page
{

private ObservableCollection<Category> Categories;

private ObservableCollection<Item> Items;


public MainPage()
{
this.InitializeComponent();
CreateCategories();
CreateItems();

}
private void CreateCategories()
{
Categories = new ObservableCollection<Category>();
Categories.Add(new Category("Kitchen", "500"));
Categories.Add(new Category("Dining Room", "501"));
Categories.Add(new Category("Living Room", "502"));
Categories.Add(new Category("Bedroom", "503"));
Categories.Add(new Category("Garage", "504"));


}

private void CreateItems()
{
Items = new ObservableCollection<Item>();
Items.Add(new Item(0,Categories ,"500", ""));
Items.Add(new Item(1,Categories, "501", ""));
Items.Add(new Item(2, Categories,"502", ""));
Items.Add(new Item(3,Categories, "600", "Master"));
Items.Add(new Item(3,Categories, "601", "Bedroom 1"));
Items.Add(new Item(3,Categories, "602", "Bedroom 2"));
Items.Add(new Item(3, Categories,"603", "Bedroom 3"));
Items.Add(new Item(4, Categories,"504", ""));

ItemGrid.ItemsSource = Items;


}

private void AddItem_Click(object sender, RoutedEventArgs e)
{

}

}
}

For more information you can refer to the links below:


http://ift.tt/1o2gIcE


Best Wishes!




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. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


Problems getting started in SSRS

Clearly the hard part (so far) is just getting the right stuff installed and running.


I made perhaps the naïve assumption that I could design and debug/run reports locally before publishing to our server. I am running Windows 7 and have (I think) everything installed. I have SSDT-BI VS 2012 installed, I installed Reporting & Integration Services form the SQL Server 2012 we have. I have been in the configuration manager and applied the defaults. I can see SSRS & SSIS are running in services (even restarted them).


Going to the ReportServer URL fails with a very generic and unhelpful message: rsServerConfigurationError. I looked into the SSRS log files for more information: No DSN present in configuration file


Not sure what DSN I need to make, if in fact I need to...who knows.


Now, I don't have the full SQL Server installed on my machine, just express, which was already there.


I just really don't know where to look next for a solution. As it is I have VS 2005, 2008, 2010 & 2013 installed, as well as SQL Server Native Clients: 2005, 2008, 2012 installed. I may have too much installed but you never know what to keep and what to discard, some application might need it.


Problems getting started in SSRS

I have not, though I've tried to connect to it using SSMS 2012 but it refuses to connect, although SQLEXPRESS is running in services. Can I not use SSMS to connect to EXPRESS? Obviously I use it typically to connect to other server-based databases, why not a local one?

Problems getting started in SSRS

Which error message are you getting when you try to connect using SSMS?


You have to use "Reporting Service Configuration Manager" to setup the ReportServer database; but for this you have to be able to logon to your SQL Server first, of course.




Olaf Helper


[ Blog] [ Xing] [ MVP]

Problems getting started in SSRS

I think my problem is that SSRS is running under a different instance than express...




Problems getting started in SSRS

No, that should be a problem. SSRS Express can only connect to SQL Server Express, but for a Standard or higher edition we don't have such a limitation.


Olaf Helper


[ Blog] [ Xing] [ MVP]

Monday, April 28, 2014

Filestream.Write or Save() shows waitcursor frequently

You might want to consider posting a code snippet that recreates your problem.


It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.


Dynamically use database name


Declare @dbname nvarchar(50)
Set @dbname = 'test'



declare @sql nvarchar(4000)
select @sql = 'use '

select @sql = @sql + @dbname + N'; SELECT
tbl.name AS [Name],
SCHEMA_NAME(tbl.schema_id) AS [Schema],
''Server[@Name='' + quotename(CAST(
serverproperty(N''Servername'')
AS sysname),'''''''') + '']'' + ''/Database[@Name='' + quotename(db_name(),'''''''') + '']'' + ''/Table[@Name='' + quotename(tbl.name,'''''''') + '' and @Schema='' + quotename(SCHEMA_NAME(tbl.schema_id),'''''''') + '']'' AS [Urn],
tbl.create_date AS [CreateDate],
CAST(
case
when tbl.is_ms_shipped = 1 then 1
when (
select
major_id
from
sys.extended_properties
where
major_id = tbl.object_id and
minor_id = 0 and
class = 1 and
name = N''microsoft_database_tools_support'')
is not null then 1
else 0
end
AS bit) AS [IsSystemObject]
FROM
sys.tables AS tbl
WHERE
(CAST(
case
when tbl.is_ms_shipped = 1 then 1
when (
select
major_id
from
sys.extended_properties
where
major_id = tbl.object_id and
minor_id = 0 and
class = 1 and
name = N''microsoft_database_tools_support'')
is not null then 1
else 0
end
AS bit)=@_msparam_0)
ORDER BY
[Schema] ASC,[Name] ASC'


exec sp_executesql @sql,N'@_msparam_0 nvarchar(4000)',@_msparam_0=N'1'


Use first row of table to determine calculation of rest of the rows of that table.


create table test (Name varchar(20),[01] int,[02] int,[03] int,[04] int,[05] int,[06] int,[07] int,[08] int,[09] int)
insert into test values('Emp 1',8,8,8,8,8,0,0,8,8),('Emp 2',8,7,8,9,8,0,0,8,7),('Emp 3',6,8,8,8,8,0,0,8,8)


;with mycte as(
select name, val,col from (select * from test) src
cross apply (values([01],'01'),([02],'02'),([03],'03'),([04],'04'),([05],'05'),([06],'06'),([07],'07'),([08],'08'),([09],'09')) d(val,col)
)

Select name,[01],[02],[03],[04],[05],[06],[07],[08],[09] from
(select name, Case when col='04' then val*2 else val end val,col from mycte) src
PIVOT (max(val) For col In ([01],[02],[03],[04],[05],[06],[07],[08],[09])) pvt





drop table test


How to record a custom event upon button click?

I am working on a small binary converter program, and I am adding a feature to it that will record the decimal that they put into a text box before conversion and then record the output of the binary/hex code that it converts to.


I want to use the StreamWriter from System.IO to record the data into a text file that the user can open from the program based upon button click. Sadly, I have no idea how to use the StreamWriter. I will post the code i have below.



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;
using System.IO;

namespace Aspire_Binary_Converter
{
public partial class mainUI : Form
{
public mainUI()
{
InitializeComponent();
}

private void convertBtn_Click(object sender, EventArgs e)
{
string convertingNumTxt = convertNumTxt.Text;

if (convertingNumTxt.Contains("-"))
{
MessageBox.Show("ERROR: Type - SYNTX; The number to be converted may not contain the dash or hyphen.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (convertingNumTxt.Contains("."))
{
MessageBox.Show("ERROR: Type - SYNTX; The number to be converted may not contain the period or decimal.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (convertingNumTxt.Contains("()"))
{
MessageBox.Show("ERROR: Type - SYNTX; The number to be converted may not contain any type of parenthesis or bracket.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
//RECORD KEEPING

if (enableRecordCheck.Checked == true)
{
viewRecordsBtn.Visible = true;
this.Update();
}

if (enableRecordCheck.Checked == false)
{
viewRecordsBtn.Visible = false;
this.Update();
}

//HEXADECIMAL / BINARY CONVERTER

if (hexadecimalCheck.Checked)
{
int number = int.Parse(convertingNumTxt);
string hex = number.ToString("x");
MessageBox.Show("Conversion to hexadecimal was sucessful. Your code is: " + hex, "Hex Conversion Sucessful", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
if (convertNumTxt.Text == null || convertNumTxt.Text == "")
{//

MessageBox.Show("ERROR: Type - DATA; The conversion box must contain a number or numerical character before the conversion process can begin.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;

}

int decimalNumber;

bool blnresult = Int32.TryParse(convertingNumTxt, out decimalNumber);
if (!blnresult)
{
MessageBox.Show("ERROR: Type - SYNTX; The number to be converted may not contain any type of letter or alphabetical character.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{

int remainder;
string result = string.Empty;
while (decimalNumber > 0)
{
remainder = decimalNumber % 2;
decimalNumber /= 2;
result = remainder.ToString() + result;
}
MessageBox.Show("Conversion was sucessful. Your binary code is: " + result, "Conversion Sucessful");
}
}
}
}
}
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
ABC_Usage frm = new ABC_Usage();
frm.Show();
}
}
}

Any Help towards this project will be greatly appreciated! Thanks for any help you guys can provide. :)


-Whutchison




Whutchison


How to record a custom event upon button click?

Hi, maybe this is what you want:



...
int remainder;
string result = string.Empty;
while (decimalNumber > 0)
{
remainder = decimalNumber % 2;
decimalNumber /= 2;
result = remainder.ToString() + result;
}
MessageBox.Show("Conversion was sucessful. Your binary code is: " + result, "Conversion Sucessful");
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Filter = "txt file|*.txt";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(dlg.FileName))
{
sw.Write(result);
}
}
}

Or you can use File.WriteAllText:



...
int remainder;
string result = string.Empty;
while (decimalNumber > 0)
{
remainder = decimalNumber % 2;
decimalNumber /= 2;
result = remainder.ToString() + result;
}
MessageBox.Show("Conversion was sucessful. Your binary code is: " + result, "Conversion Sucessful");
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Filter = "txt file|*.txt";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
System.IO.File.WriteAllText(dlg.FileName, result);
}
}


Dynamically use database name

Hi Guys,


Is there any way I can put the database name as a variable in below query? I mean before select statement, i would like to use USE DATABASENAME command.



exec sp_executesql N'SELECT
tbl.name AS [Name],
SCHEMA_NAME(tbl.schema_id) AS [Schema],
''Server[@Name='' + quotename(CAST(
serverproperty(N''Servername'')
AS sysname),'''''''') + '']'' + ''/Database[@Name='' + quotename(db_name(),'''''''') + '']'' + ''/Table[@Name='' + quotename(tbl.name,'''''''') + '' and @Schema='' + quotename(SCHEMA_NAME(tbl.schema_id),'''''''') + '']'' AS [Urn],
tbl.create_date AS [CreateDate],
CAST(
case
when tbl.is_ms_shipped = 1 then 1
when (
select
major_id
from
sys.extended_properties
where
major_id = tbl.object_id and
minor_id = 0 and
class = 1 and
name = N''microsoft_database_tools_support'')
is not null then 1
else 0
end
AS bit) AS [IsSystemObject]
FROM
sys.tables AS tbl
WHERE
(CAST(
case
when tbl.is_ms_shipped = 1 then 1
when (
select
major_id
from
sys.extended_properties
where
major_id = tbl.object_id and
minor_id = 0 and
class = 1 and
name = N''microsoft_database_tools_support'')
is not null then 1
else 0
end
AS bit)=@_msparam_0)
ORDER BY
[Schema] ASC,[Name] ASC',N'@_msparam_0 nvarchar(4000)',@_msparam_0=N'1'






Controls don't return to their original position when switching between portrait and landscape

This is my



<Page
x:Class="MyApp_WindowsStore.MainPage"
xmlns="http://ift.tt/w9rHWX;
xmlns:bm="using:Bing.Maps"
xmlns:x="http://ift.tt/zZkFEV;
xmlns:local="using:MyApp_WindowsStore"
xmlns:d="http://ift.tt/PuXO1J;
xmlns:mc="http://ift.tt/R4RR6u;

mc:Ignorable="d" >

<Grid Height="Auto">
<Grid.Background>
<ImageBrush ImageSource="Assets/Backgrounds/wallpaper.jpg" AlignmentX="Left"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Canvas Grid.Row="0">
<Canvas.ZIndex>
1
</Canvas.ZIndex>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!--<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
VerticalAlignment="Top"
AutomationProperties.Name="Back"
AutomationProperties.AutomationId="BackButton"
AutomationProperties.ItemType="Navigation Button"/>-->

<TextBlock Grid.Column="1" x:Name="pageTitle" Text="App Title" Style="{StaticResource HeaderTextBlockStyle}"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,50,30,0" >

</TextBlock>

</Grid>
</Canvas>
<ScrollViewer Grid.Row="1" Margin="0,-140,0,0" VerticalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden" HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible">

<!--<StackPanel FlowDirection="LeftToRight" Orientation="Horizontal" >-->
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>

<Grid Width="1024" Grid.Column="0">
<Canvas>
<Canvas.ZIndex>
1
</Canvas.ZIndex>
<TextBlock Text="Current" FontSize="32" Margin="117,130,0,0" ></TextBlock>
</Canvas>
<StackPanel FlowDirection="LeftToRight" Orientation="Horizontal" VerticalAlignment="Bottom">
<Grid Height="400" Width="400" HorizontalAlignment="Left" VerticalAlignment="Top">
<Border Margin="-20,0,0,0" HorizontalAlignment="Left" Width="300" Height="35" BorderThickness="0.5" RenderTransformOrigin="0.5,0.5" BorderBrush="{Binding Path=PlotColor, Mode=OneWay}" UseLayoutRounding="False" d:LayoutRounding="Auto">
<Border.RenderTransform>
<CompositeTransform Rotation="270"/>
</Border.RenderTransform>
<ProgressBar Margin="0,-1.5,0,0" Style="{StaticResource ProgressBarStyle1}" Value="{Binding Path=Current, Mode=OneWay}" Foreground="{Binding Path=PlotColor, Mode=OneWay}" RenderTransformOrigin="0.5,0.5" >

</ProgressBar>
</Border>

</Grid>
<Grid Height="400" Width="400" HorizontalAlignment="Left">

</Grid>
</StackPanel>
</Grid>

<Grid Width="900" Grid.Column="1">
<Grid.Background>
<SolidColorBrush Color="#FF0E0D23" Opacity="0.95"/>
</Grid.Background>
<Canvas>
<Canvas.ZIndex>
1
</Canvas.ZIndex>
<TextBlock Text="Forecast" FontSize="32" Margin="50,130,0,0" ></TextBlock>
</Canvas>
</Grid>
<Grid Width="900" Margin="0,0,0,0" Grid.Column="2">
<Grid.Background>
<SolidColorBrush Color="#FF0E0D23" Opacity="0.95"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="140"></RowDefinition>
<RowDefinition ></RowDefinition>
</Grid.RowDefinitions>
<Canvas>
<Canvas.ZIndex>
1
</Canvas.ZIndex>
<TextBlock Text="Location" FontSize="32" Margin="50,130,0,0" ></TextBlock>

</Canvas>
<Grid Grid.Row="1" Margin="50,50,0,0" Width="700" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="200"></RowDefinition>
</Grid.RowDefinitions>

<bm:Map Grid.Row="0" Margin="0,0,0,0" Credentials="ApLSRNznoDNW3KLuzC4AxVwBGl-bRwgtVkAXT-CehivBiGXTn_yXRIS01v2k93-f" x:Name="myMap" ></bm:Map>
<Button Grid.Row="1" Width="75" Height="75"></Button>
</Grid>

</Grid>

</Grid>
</ScrollViewer>
</Grid>
</Page>



XAML


Text cannot be parsed

Hi Doresa,


Can you please provide more details/background on your issue?


Right now it is too limited for us to understand what happened and give advice.


Thanks,


How to get the response time of all the sites in a site collection using powershell

Perfmon won't do that. It only goes to the Site level so it can't/won't do sub sites.


Your best bet is to run a script on a client machine that opens an IE session, browses to the page and then saves the data into a CSV file.


How to get the response time of all the sites in a site collection using powershell

That is the best idea but how to calculate the response time from internet explorer? Another concern is that from my any local machine how can I run a generic script for all the sites in a site collection?


Content Query webpart - How to present data

I am querying a Document Library using a Content Query Web Part in SharePoint 2010. But how do I make it resemble like the Document Lib. I mean how do I align all columns. Looks like content query web part cannot do that. Is there a way around. Thanks so much.


Mayank


Retrieving information from database into text box.




Hi!



I am trying to retrive information data from Access database into textbox in vb.net. I am able to get the count but not able to display it in the database.



For example: total state in india is 29. so need to display all the names. I have textbox in the form as statename1.text, statename2.text, statename3.text till statename29.text. So I want to display in loop.





dim i, p as integer

command = New OleDbCommand("Select state from country where country="India""", connection)

dataReader = command.ExecuteReader

dataReader.Read()



i = 1

P = 0





Do While i <> 30

statename & i &.text = dataReader(P).ToString()







P = P + 1

i = i + 1

Loop



I am trying something like this but i know, its not right. Please advice. I am getting error on "statename & i &.text"



Regards,



Prabhu Venkatraman





Retrieving information from database into text box.

Hi, if you know the name of control, you can use ControlCollection.Item Property or ControlCollection.Find method to get it.


http://ift.tt/1mTOPnc


http://ift.tt/1m4ElVc


sample code below:



Do While i <> 30
Me.Controls("statename" & i.ToString()).Text = dataReader(p).ToString()
P = P + 1
i = i + 1
Loop

Or



Do While i <> 30
Me.Controls.Find("statename" & i.ToString(), True)(0).Text = dataReader(p).ToString()
p = p + 1
i = i + 1
Loop


Filestream.Write or Save() shows waitcursor frequently

I posted this in another thread as well - basically a file.save operation shows a waitcursor briefly before going back to default. Like a filestream.write(memorystream) to a certain location in the desktop. Me and another senior moderator in another website tried to put the image copied onto another thread, tried Backgroundworker thread to run aysnc etc - it didnt work. The waitcursor appears briefly for every file save op - I see it its bcos its a system-wide I\O op, but I certainly don't want the user to keep seeing waitcursor often - like flickering.


The senior mod told me he wrote a similar code and didnt see any waitcursor in his syetm even briefly. Mine is a win 7, with a 1 GB Ram and 1.7 Ghz - am thinking its down to OS\hardware as there is no other way in code to solve it. Any thoughts or valuable inputs is greatly appreciate.


PS: This is for a legit software and the files are saved locally and not transmitted through intranet\internet.


What is proper way to prevent two separate threads from running at same time?

Hi, you can try this:




private object _locker = new object();

private void timer_Elapsed(object sender, ElapsedEventArgs e)
{
lock (this._locker)
{
...do timer stuff....
}
}

void DoStuff()
{
lock (this._locker)
{
...do my stuff...
}
}


What is proper way to prevent two separate threads from running at same time?

Another option is ReaderWriterLockSlim, it may be a bit overkill for your situation, but it definitely has flexibility: http://ift.tt/LyDsgQ


It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.


PIVOT and UNPIVOT


create table test (QTY int, AMT int)
insert into test values (1,2),(1,1),(2,2)


select MeasureCode,Measure from (select * from test) src
cross apply (values(QTY,'QTY'), (AMT,'AMT')) d(Measure,MeasureCode)



drop table test


Find user defined system tables

Try



select * from sys.system_objects where is_ms_shipped = 0



I found this in SQL Server 2012 documentation when I ran a Google search on your question.




For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


Find user defined system tables

Thanks but I need below highlight table list...

Find user defined system tables

A few things are "hard coded" in SSMS to separate user and system objects; "dbo.sysdiagrams" is such a case.


Run SQL Server Profiler and refresh the view in SSMS, then you get the query to select all "system tables", looks like this:



exec sp_executesql N'SELECT
tbl.name AS [Name],
SCHEMA_NAME(tbl.schema_id) AS [Schema],
''Server[@Name='' + quotename(CAST(
serverproperty(N''Servername'')
AS sysname),'''''''') + '']'' + ''/Database[@Name='' + quotename(db_name(),'''''''') + '']'' + ''/Table[@Name='' + quotename(tbl.name,'''''''') + '' and @Schema='' + quotename(SCHEMA_NAME(tbl.schema_id),'''''''') + '']'' AS [Urn],
tbl.create_date AS [CreateDate],
CAST(
case
when tbl.is_ms_shipped = 1 then 1
when (
select
major_id
from
sys.extended_properties
where
major_id = tbl.object_id and
minor_id = 0 and
class = 1 and
name = N''microsoft_database_tools_support'')
is not null then 1
else 0
end
AS bit) AS [IsSystemObject]
FROM
sys.tables AS tbl
WHERE
(CAST(
case
when tbl.is_ms_shipped = 1 then 1
when (
select
major_id
from
sys.extended_properties
where
major_id = tbl.object_id and
minor_id = 0 and
class = 1 and
name = N''microsoft_database_tools_support'')
is not null then 1
else 0
end
AS bit)=@_msparam_0)
ORDER BY
[Schema] ASC,[Name] ASC',N'@_msparam_0 nvarchar(4000)',@_msparam_0=N'1'



it filters on "extended properties" for microsoft_database_tools_support




Olaf Helper


[ Blog] [ Xing] [ MVP]

Find user defined system tables

Awesome man! I got it.


Thank you very much!


How align Grouped Items vertically

Hi Gustavo,


There is not good way to merge multiple groups in the same column in a Xaml GridView. You would need to implement your own custom layout.


The start screen is not based on the Xaml GridView code. While it has the same basic design patterns, the exact details are different.


--Rob


why is windows storage namespace not supported in PCL projects?

Hi,


I moved this thread to Building Windows Store apps with C# or VB forum for better support.


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.


Remove the drilldown functionality/Expand all rows when report is exported in PDF format

All,


I know that when the report needs to be exported to the PDF format, you would first have to expand all the groups and then export it to PDF only then it would show all the rows expanded when you open the PDF file.


But, my question is, say, if we have a lot of drill downs in the report, so, I don't want the user to manually go and expand each each row group and then export it, so, is there a way that only when the report is exported to PDF format, then I want the report to be in the expanded format (with no drilldowns) other wise when its exported to excel I don't want to do any changes, since the drilldowns work fine in Excel.


Remove the drilldown functionality/Expand all rows when report is exported in PDF format

Any ideas/suggestions to accomplish this?


Does it leave me with only one option that I have to manually expand the row groups and then export it to PDF?


Remove the drilldown functionality/Expand all rows when report is exported in PDF format


Any ideas/suggestions to accomplish this?


Does it leave me with only one option that I have to manually expand the row groups and then export it to PDF?



You need to add a boolean parameter to collapse and expand drill down option in the report. Refer the below link,


http://ift.tt/S4dHyJ




Regards, RSingh


Remove the drilldown functionality/Expand all rows when report is exported in PDF format

RSingh(), first of all thank you so much for replying back. So, this is going to be a visible parameter in the report, right? Is there a way we can avoid this parameter and export the expanded report only when the export format is PDF?


Of course, if there is no solution for that scenario, then I would have to add that boolean parameter.


What is proper way to prevent two separate threads from running at same time?

I have two functions, one is timer call back function, and the other is a function which is called by a running thread, it is not the thread start function itself, this second function is called by another thread.


(One is a timer thread)


If I hit timer_Elapsed function first, I want to block on DoStuff until function exits


If I hit DoStuff function first I want to block on timer_Elapsed until function exits


What is the proper as well as efficient way to do this.


private void timer_Elapsed(object sender, ElapsedEventArgs e)


{


...do timer stuff....


}


{thread started somewhere else....at some point calls DoStuff() }


void DoStuff()


{


...do my stuff...


}


OpenFilePicker Openning to Specific location

No. You'd present your own custom UI. From the user's point of view that's all internal to the application.

How to add code behind to SandBox solution



I have a strange issue with clientcontext
The code fails on a row spListobjItems.get_count(); in onSuccess2()
with this error:
The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Here is my code:


function onSuccess2() {
var liCount = spListobjItems.get_count();
for (x = 0; x < liCount; x++) {
var listItem = spListobjItems.itemAt(x);
var videoTitle = listItem.get_item("Title");
}
}

function onFail(sender, args) {
}


var clientContext;
var spWebobj;
var spListobj;
var spCamlQuery;
var spViewXML;
var spListobjItems;
var imgSrc;
var listTitle;

function myCallback() {

$("img").each(function () {
imgSrc = $(this).attr('src');
listTitle = imgSrc.split('/')[1];
try {
clientContext = SP.ClientContext.get_current();
spWebobj = clientContext.get_web();
spListobj = spWebobj.get_lists().getByTitle(listTitle);

spCamlQuery = new SP.CamlQuery();
spViewXML = '<View><Query><Where><Eq><FieldRef Name="FileRef"/><Value Type="Url">' + imgSrc + '</Value></Eq></Where></Query></View>';
spCamlQuery.set_viewXml(spViewXML);
spListobjItems = spListobj.getItems(spCamlQuery);
clientContext.load(spWebobj);
clientContext.load(spListobjItems);

clientContext.executeQueryAsync(onSuccess2, onFail);

}
catch (exception) {
return true;
}
});
return true;
}

$(document).ready(function () {
ExecuteOrDelayUntilScriptLoaded(myCallback, "SP.js");

});





SharePoint 2010 words macros

Hi Everyone,


So I have this case where I have a word document that needs to be placed into a sharepoint library as a content type, the kicker is that we need to have macros working with this document, and they don't. In fact, when the users go to the library to create a new document, and then try to run the macros in the word doc, they are gone.


Can anyone help with this?? The version of both sharepoint and word is 2010.




Best regards, Mike


SharePoint 2010 words macros

hi,


I don't think you can create a document content type with macro enabled template as this is an known issue. Instead you can use the template to create the document in client machine and upload in the SharePoint document library.


Refer this article for more info


Hope this will help you




Senthilrajan Kaliyaperumal


C# dynamic data - find the side that hit

it will just stall until tank A get to 72 or Tank B decrease to 72 to take it.


Please do not forget to click “Vote as Helpful” if the reply helps/directs you toward your solution and or "Mark as Answer" if it solves your question. This will help to contribute to the forum.


how parse xelemnts that have the same name but hasn'l attributes?

i think you have typos, please try this code instead:



esTranslation = from es in element.Descendants("gloss") where (x => !string.IsNullOrEmpty(es.Attribute("xml_Lang").Value == "spa" )) select es.Value



hope this helps!


how parse xelemnts that have the same name but hasn'l attributes?

Is the same line what I have .(ーー;)


scape percentage (%) character in sp_addmessage

Good Afternoon!


Please forgive my English level.


I'm trying to scape a percentage simbol that I pass as a parameter in a RAISERROR control inside a stored procedured but it seems SQL Server read it as a variable.


My message is defined like this:



EXEC sp_addmessage @msgnum = 60001, @severity = 16,
@msgtext =
N'The quota filled with %s and the percentage filled with %s must be mutually exclusive, ie, if one of them is nonzero, the other must be zero.',
@lang = 'us_english',
@replace = 'replace';
GO



Then I run a RAISE error inside a stored procedure LIKE THIS:



RAISERROR(60001, -1, -1, N'$1,000,000.00', N'100.00%');



But i obtain the next error message when I execute the stored procedure:


Msg 2787, Level 16, State 1, Procedure pa_1, Line 204

Invalid format specification: '% must be mutually exclusive, ie, if one of them is nonzero, the other must be zero.'.

How can I scape the percentage (%) character inside the especification of the sql server stored procedure sp_addmessage to obtain the desired result


Thanks a lot for your valuable help.