Monday, September 30, 2013

Adding a column to all user tables in ms sql server

There is an undocumented but well known stored procedure sp_msforeachtable:
exec sp_msforeachtable 'alter table ? add {colname} {dataType} {null|not null} ....';

Friday, September 27, 2013

Remove totals from crystal report cross tab

In the top-left corner of the Cross-Tab there is a blank cell - right click inside that cell and select Cross-Tab Expert from the shortcut menu.


On the third tab, Customize Style, there are check boxes where you can suppress subtotals and grand totals.

Variable persistence on postback asp net

An ASP.NET page class file is destroyed after it is served to the client. The most chosen method for preserving variables in ASP.NET from one page load to the next is to store them in
  • ViewState
    • Small data for current page only
  • Session
    • Small or large data for across the web site or app
  • Hidden Input 
    • Small data for current page only
  • Cookies
    • Small data for long time across the website or app
  • Cache 
    • Small or large data for across the website or app

Saturday, September 21, 2013

How to change the .htaccess file name?


To use a different name from the the default .htaccess use the AccessFileName directive in httpd.conf file.
AccessFileName yourFileName
All you need to do is to reload Apache and the new setting will take effect.

TopHost Hostgator GoDaddy .htaccess Settings

The top web comes with mod_rewrite enabled. To use it, create a. htaccess file with the appropriate directives. 

Remember to always insert the Directive: 
RewriteBase / 

where / and 'the path of the. htaccess file, so if the. htaccess file is located in the subfolder demo must' be: 
RewriteBase /demo

Wednesday, September 11, 2013

How to hide asp net DataPager when there is only one page

When you use DataPager with ListView and there is only one page of data you still see the pager. So if you don't like the pager like me you can use below piece of code to hide it.

//Data Pager Outside ListView
        protected void lView_DataBound(object sender, EventArgs e)
        {
            dPager1.Visible = (dPager1.PageSize < dPager1.TotalRowCount);
        }
 
        //Data Pager Inside ListView
        protected void lView_DataBound(object sender, EventArgs e)
        {
            DataPager dPager = (DataPager)lView.FindControl("dPager1");
            dPager.Visible = (dPager.PageSize < dPager.TotalRowCount);
        }

Tuesday, September 10, 2013

How to display original quality image in Crystal Reports

Step 1:
Open any crystal report
Step 2:
Go to Menu->Crystal Report->Design->Default Settings
Step 3:
Go to Reporting Tab and make sure "Retain Original Image Color Depth" is checked

Note: Try using images with no transpareny for good quality.

Sunday, September 8, 2013

What is the difference between Public, Private, Protected And Internal

Anywhere Same  class Derived Classes Same Assembly Derived Classes in
another assembly
Public




Private




Protected



Internal




Protected
internal



Saturday, September 7, 2013

How to reset / change user password programmatically using asp net membership

MembershipUser user = Membership.GetUser({UserId});
user.ChangePassword(user.ResetPassword(), {NewPassword});

How to restrict get; setter; to get only inside c# asp net classes

Lets say you have a get, set property inside a class say IP
public String IP { get; }
 
When I specify get only I wont be able to set the property even inside the class itself. e.g
this.IP = "127.0.0.1";
Property or indexer 'IP' cannot be assigned to -- it is readonly 
Solution, just type private keyword with set property like this
public String IP { getprivate set; }
All done

Wednesday, September 4, 2013

How to get first and last day of month asp net c#

First day of month
    public static DateTime GetFirstDayOfMonth(DateTime dt)
    {
        return new DateTime(dt.Year, dt.Month, 1);
    }
Last day of month
    public static DateTime GetLastDayOfMonth(DateTime dt)
    {
        return new DateTime(dt.Year, dt.Month, 1).AddMonths(1).AddDays(-1);
    }

Tuesday, September 3, 2013

Search Stored Procedure for Column Name in MS SQL SERVER

SELECT DISTINCT OBJECT_NAME(OBJECT_ID),object_definition(OBJECT_ID)FROM sys.ProceduresWHERE object_definition(OBJECT_ID) LIKE '%' + '{COL_NAME}' +'%'

SAP Crystal Reports for visual studio 2010 and 2012 and 2013

Support Packs, Fixed Issues and Distribution File downloads

Fixes for each Support Pack are prioritized and released on or about end of each yearly quarter. All support packs are full builds of Crystal Reports for Visual Studio 2010/2012, thus it is not necessary to update incrementally. The most recent Support Pack in the below table is listed first.
To keep current and up to date with new releases as well as KBAs and more follow us on Twitter
Update: All Service Packs are cumulative so we are removing the links to previous patches and will be keeping 3 or 4 still active. Links still work if you have them. For installing and starting at the RTM build and progressing to the latest SP is not required.

Please note: To integrate "SAP Crystal Reports, developer version for Microsoft Visual Studio" into VS 2010 or 2012 (SP 7 and higher) or VS 2013 (SP 9 or higher) or VS 2015 RC (SP14) - VS 2015 (fully - SP 15), you must run the Install Executable. Running the MSI will not fully integrate Crystal Reports into VS. MSI files by definition are for runtime distribution only.
By default Windows 10 does not install the 3.5 framework, CR for VS still needs it. Select it by "Turn Windows feature on or off" and choose both options.

Note 2: SAP Crystal Reports, Developer Version for Visual Studio .NET does NOT support Express Editions of any version of Visual Studio .NET. VS.

New In SP16 Release
  1. Support for Edge browser on Win 10.
  2. Support for Safari 9 on Mac OS 10.11.
  3. Addressed several Incidents. 
    4. Support for HANA SP11

Install ExecutableFixed IssuesMSI 32 BitMSI 64 BitMSM
32 Bit
ClickOnce
32/64
ClickOnce
"Homesite"
WEB XML Deployment
Support Pack 16
(v.13.0.16.1954
SP16 Fixed Issues32bit.msi64bit.msi13_0_16.msnClickonce32/64clickonce32
clickonce64
crdbxml16.msi
Support Pack 15
(v.13.0.15.1840
SP15 Fixed Issues32bit.msi64bit.msi13_0_15.msnClickonce32/64clickonce32
clickonce64
crdbxml15.msi
Support Pack 14
(v.13.0.14.1720)
SP14 Fixed Issues32bit.msi64bit.msi13_0_14.msnclickonce32/64clickonce32
clickonce64
crdbxml14.msi
Support Pack 13
(v.13.0.13.1597)
SP13 Fixed Issues32bit.msi64bit.msi13_0_13.msnclickonce32/64clickonce32
clickonce64
crdbxml13.msi
Support Pack 12 (v.13.0.12.1494)SP12 Fixed Issues Wiki32bit.msi64bit.msi13_0_12.msnclickonce32/64clickonce32
clickonce64
crdbxml12.msi
RTM
(v. 13.0.0.x)
Release Notes
Installation Guide
32bit.msi64bit.msi13_0.msmclickonce32/64clickonce32
clickonce64
N/A
( previous Fixed Issues links are in the current links )

WARNING: Please refer to Knowledge Base article 2007224 for more info on configuring WEB Applications in Visual Studio 2013.
WARNING 2 - SP 11 had Regression issues, please use the latest SP now for all updates
SP 8 ClickOnce Note: There is a minor issue in the Product.xml file for ClickOnce Deployment package.
See Kbase 1957502 or manually modify the file to update the version:
<BypassIf Property="CRRuntime64Version" Compare="VersionGreaterThanOrEqualTo"  Value="13.0.8"/>
Only affects the Developers PC.
Note: Manual deployment of crdb_xml drivers requires manually installing and deploying JRE/JDK
1871962 - How To manually deploy Service Pack 6, and above, crdb_XML data source driver for Crystal Reports Developer for Visual Studio
Note: Clickonce32/64 is managed by the xml file for which one is installed.
1534388 - CRVS2010 - Creating Click Once deployment
Note: Click Once "Homesite" is to tell your installer to go here for the runtime.