Thursday, November 13, 2008

C# find last months date range

DateTime firstDay = new DateTime(DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month, 1);

int DaysinMonth = DateTime.DaysInMonth(DateTime.Now.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month);

DateTime lastDay = firstDay.AddMonths(1).AddTicks(-1);

used code found here:
http://anuraj.wordpress.com/2007/12/03/last-day-and-first-day-of-the-month-using-c/

Tuesday, June 10, 2008

SSRS 2005 Report prints blank pages - landscape mode

Re: SSRS 2005 Report prints blank pages - MSDN Forums: "SSRS 2005 Report prints blank pages"

Body + Right marigin + Left margin should be less than page width
Body + Top margin + Bottom margin should be less than page height

If you have header and footer take them also into account
If you have any text box ,please check it is width and also matrix data regions.

Thursday, April 24, 2008

c# read Excel 2007 .xlsx files

In order to read .xlsx files you need the drivers: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7554f536-8c28-4598-9b72-ef94e038c891

If you don't, you may get the error: "Could not find installable ISAM."

dir = new DirectoryInfo(System.Environment.CurrentDirectory);
xlsFiles = dir.GetFiles("*.xls", SearchOption.AllDirectories);

//loop thru all the text files
foreach (FileInfo xlsFile in xlsFiles)
{
DataSet dataSet1 = new DataSet();
OleDbConnection connection = new System.Data.OleDb.OleDbConnection();
OleDbDataAdapter dataAdapter1;

if (System.IO.Path.GetExtension(xlsFile.Name) == ".xlsx")
{

connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + xlsFile.FullName + ";Extended Properties='Excel 12.0;'";
}
else
{
connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + xlsFile.FullName + ";Extended Properties='Excel 8.0;'";
}

dataAdapter1 = new OleDbDataAdapter("select * from [Sheet1$]", connection);

dataAdapter1.Fill(dataSet1);
DataTable dt = dataSet1.Tables[0];

}

Friday, March 7, 2008

Jeremy Schneider's Blog: Hide form tag, but leave content

Jeremy Schneider's Blog: Hide form tag, but leave content: "The problem is that a common practice in ASP.NET is to have a tag 'high up' in the HTML, usually in the Master page. HTML doesn't allow overlapping tags, so my PayPal button won't work. Since the higher level is in the Master page, it makes removing it pretty messy. As far as I know, there's no built-in 'hide this tag"

Tuesday, March 4, 2008

ProperCase function in SSRS ( SQL Server Reporting Services)

=StrConv(Fields!Name.Value, vbProperCase)


found the answer here:

Any ProperCase function in SSRS report - TechNet Forums: "Any ProperCase function in SSRS report"