Thursday, January 7, 2016

Run a SQL Server procedure from Excel


I'm using SQL Server 2008 Enterprise. I created a stored procedure in one database. The stored procedure is composed of several queries from the same database. Final combined result set is being displayed.

I try to execute it via Excel to create a report from the output which I got from stored procedure, so the results will appear automatically in Excel sheet, but I'm getting the below error:


Once I was creating the SP with the simple SQL Queries, it was working fine, but not for the stored procedure which are having multiple queries, loops and other functionality

After trying various different option, I found the solution of this.

I added "SET NOCOUNT ON" to the beginning of the stored procedure.

Here is the link which can be helpful to read about this.
https://msdn.microsoft.com/en-us/library/ms189837.aspx

Friday, December 18, 2015

Telerik Controls : Hiding PageSize functionality in Telerik RadGrid Control


Hiding the “PageSize” Option under RadGrid not to change the Page Size in RadGrid
 

Want to share the code snippet to hide the same.

 

protected void rgContractorsListAll_ItemDataBound(object sender, GridItemEventArgs e)

{

            #region GridPagerItem

            if (e.Item is GridPagerItem)

            {

                GridPagerItem pager = (GridPagerItem)e.Item;

                Label lblPageSize = (Label)pager.FindControl("ChangePageSizeLabel");

                if(lblPageSize != null)

                    lblPageSize.Visible = false;

 

                RadNumericTextBox txtPageSize = (RadNumericTextBox)pager.FindControl("ChangePageSizeTextBox");

                if (txtPageSize != null)

                    txtPageSize.Visible = false;

 

                Button btnChangePageSize = (Button)pager.FindControl("ChangePageSizeLinkButton");

                if (btnChangePageSize != null)

                    btnChangePageSize.Visible = false; 

            }

            #endregion

}

Wednesday, December 2, 2015

Visual Studio : Templates are missing while creating a new project

Missing templates in Visual Studio installed templates

1. Close All the Visual Studio Instances.
2.  Open visual studio command prompt.
2.  Run below command on the prompt.
 
 
devenv /installvstemplates
 
 
After finishing the command, if you will open Visual Studio, your missing templates would be available.