Hi,
I have come across this post many times while developing reports in SSRS.
So just thought of sharing the link
http://www.ssw.com.au/Ssw/Standards/Rules/RulesToBetterSQLReportingServices.aspx
Bye.
Hi,
I have come across this post many times while developing reports in SSRS.
So just thought of sharing the link
http://www.ssw.com.au/Ssw/Standards/Rules/RulesToBetterSQLReportingServices.aspx
Bye.
Hi,
In one of our SSRS Report we had 2 Report Parameters, one for “From Date” and other for “To Date”.
On selecting values for them through calendar control, the value was being displayed in the proper format (mm/dd/yyyy). However the value being passed to the query was in the format (dd-mm-yyyy), because of which we were getting “The date/time format is not valid” error.

The following was the regional setting in the server.
We changed it to English (United States)

We tried running the report, but we again got the same issue.
Next we tried by changing the Language Settings of Internet Explorer.

This also didn’t solve the issue.
Finally thought of restarting the server, in case if the settings might not have got reflected properly.
After restarting the system, again tried running the report and it ran successfully J

Hope it helps.
Hi,
We had one requirement in which we wanted to change the logging level of log4net programmatically based on the value passed.
Suppose this is how we have configured log4net in our application.
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="TestLog.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Composite"/>
<datePattern value="yyyyMMdd"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="10MB"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%d{yyyy-MM-dd HH:mm:ss}] [%p] [%c:%L] - %m%n"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingLogFileAppender"/>
</root>
</log4net>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
The sample code for changing the log level
namespace SampleLogApp
{
using System.Reflection;
using log4net;
using log4net.Core;
using log4net.Repository;
using log4net.Repository.Hierarchy;
using log4net.Config;
public partial class Form1 : Form
{
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Person> lstPerson;
public Form1()
{
InitializeComponent();
// configure the log4net logging
XmlConfigurator.Configure();
}
private void btnStartLogging_Click(object sender, EventArgs e)
{
foreach(Person person in lstPerson)
{
// set the logging type depending on person
SetLoggingLevel(person.LogType);
logger.Debug("Debug: " + person.FullName);
logger.Info("Info: " + person.FullName);
logger.Warn("Warn: " + person.FullName);
logger.Error("Error: " + person.FullName);
}
}
private void Form1_Load(object sender, EventArgs e)
{
lstPerson = new List<Person>();
lstPerson.Add(new Person() { FullName = "Abhinav Ranjan", LogType = "Debug" });
lstPerson.Add(new Person() { FullName = "Nirav Pancholi", LogType = "Info" });
lstPerson.Add(new Person() { FullName = "Shobhit Bhatnagar", LogType = "Error" });
}
/// <summary>
/// Sets the logging level.
/// </summary>
/// <param name="logType">Type of the log.</param>
private static void SetLoggingLevel(string logType)
{
Logger currentLogger = (Logger)logger.Logger;
currentLogger.Level = currentLogger.Hierarchy.LevelMap[logType];
}
}
}
The output in TestLog.txt
[2012-04-16 00:17:27] [DEBUG] [SampleLogApp.Form1:39] – Debug: Abhinav Ranjan
[2012-04-16 00:17:27] [INFO] [SampleLogApp.Form1:40] – Info: Abhinav Ranjan
[2012-04-16 00:17:27] [WARN] [SampleLogApp.Form1:41] – Warn: Abhinav Ranjan
[2012-04-16 00:17:27] [ERROR] [SampleLogApp.Form1:42] – Error: Abhinav Ranjan
[2012-04-16 00:17:27] [INFO] [SampleLogApp.Form1:40] – Info: Nirav Pancholi
[2012-04-16 00:17:27] [WARN] [SampleLogApp.Form1:41] – Warn: Nirav Pancholi
[2012-04-16 00:17:27] [ERROR] [SampleLogApp.Form1:42] – Error: Nirav Pancholi
[2012-04-16 00:17:27] [ERROR] [SampleLogApp.Form1:42] – Error: Shobhit Bhatnagar
The helpful post
http://geekswithblogs.net/rakker/archive/2007/08/22/114900.aspx
Hope it helps.
Hi,
We had a requirement to encrypt a particular node and its corresponding child elements in one of our xml file. While searching for the best and the simplest way to do so, I came across these wonderful posts which make use of EncrptedXml class.
http://www.devx.com/dotnet/Article/21564/1954
http://dotnetslackers.com/articles/xml/XMLEncryption.aspx
http://blogs.msdn.com/b/shawnfa/archive/2003/11/14/57032.aspx
Hope it helps
ObservableCollection only provided notifications when we make any change in the collection itself like Adding or Removing an Item.
If we update any properties of a contained class, it doesn’t raise any notifications.
For e.g.
If I have an ObservableCollection of Person object and it is bind to a TreeView. If I add or remove person object from the ObservableCollection I will be able to see the changes in my TreeView also.
Here Person object has only one string property FullName

Now if I click on Change Name button, which simply renames the selected Person, I will not be able to see the change in my TreeView.
Here in this case we need to call the Refresh method of CollectionViewSource.
CollectionViewSource.GetDefaultView(this.observableCollPerson).Refresh();
https://skydrive.live.com/redir.aspx?cid=2312e1103cbe5ecd&resid=2312E1103CBE5ECD!339&parid=root
Have a look at this solution as well
Hope it helps.
Continuing the previous post
https://nishantrana.wordpress.com/2012/04/08/creating-dynamic-tabitem-in-wpf/
let us add the Close Context menu to our TabItem.
To do this we need to add the Context Menu tag to the DataTemplate defined for the Tab.
</pre>
<TabControl Height="271" HorizontalAlignment="Left" Margin="123,9,0,0" Name="mainTabControl" VerticalAlignment="Top" Width="441"
IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding ObservableCollectionTabItems}" Background="White">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Header}" >
<TextBlock.ContextMenu>
<ContextMenu>
<MenuItem Header="Close" Click="MenuItem_Click">
</MenuItem>
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
<pre>
Add the following code to the ViewModel class for the MainWindow.
public void CloseTabItem(Object sender)
{
VMParentForViews vmParentForViews = (sender as MenuItem).DataContext as VMParentForViews;
this.ObservableCollectionTabItems.Remove(vmParentForViews);
}
Call the above method from the code behind of the MainWindow’s MenuItem_Click event
This is how the Close menu looks like, clicking on it closes the tab item. (i.e. removes it from the ObservableCollection to which tab control is bind)

The sample application link
https://skydrive.live.com/redir.aspx?cid=2312e1103cbe5ecd&resid=2312E1103CBE5ECD!338&parid=root
Hope it helps