Friday, July 29, 2011

Error in executing xp_cmdshell in SQL Server 2005


EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE

Thursday, July 28, 2011

SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because .....

Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1

SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.

Export Gridview to Excel - Fixing Error -C# asp.net

In order to export Gridview to Excel we need to take care of following:-
 
1. on top of the page - enableEventValidation ="false"
2. following is to convert into excel
protected void Button2_Click(object sender, EventArgs e)

{

string style = @"<style> .text { mso-number-format:\@;border:.5pt solid black; } </style> ";

string attachment = "attachment; filename=Report.xls";

Response.ClearContent();

Response.Write("<center>");

Response.Write("Gross Profit Report");

Response.Write("</center>");

Response.AddHeader("content-disposition", attachment);

Response.ContentType = "application/ms-excel";

StringWriter sw = new StringWriter();

HtmlTextWriter htw = new HtmlTextWriter(sw);

GridView1.RenderControl(htw);

Response.Write(style);

Response.Write(sw.ToString());

Response.End();

}

3. put following code:

public override void VerifyRenderingInServerForm(Control control)

{

/* Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. */

}

get Row number group by SQL-Server

select

payroll_item,[name],Row_number() OVER(PARTITION BY payroll_item ORDER BY payroll_item) AS 'OBJ_Detail'

from Tempprdetail

Saturday, July 23, 2011

Fix:Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and SQL_Latin1_General_Pref_CP1_CI_AS" in the equal to operation.

How to fix
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and SQL_Latin1_General_Pref_CP1_CI_AS" in the equal to operation.

Use COLLATE DATABASE_DEFAULT after your join field.

select * from Tempprdetail
left outer join rk0901 on gmobj COLLATE DATABASE_DEFAULT =gl_OBJ COLLATE DATABASE_DEFAULT
and gmmcu COLLATE DATABASE_DEFAULT =HOME_BU COLLATE DATABASE_DEFAULT

Tuesday, July 12, 2011

Batch Approval Program JD Edwards

How to use Batch Approval Program - P00241

 

Monday, July 11, 2011

Fetch and write description from F0101

in find and browse form you can get description and other info on Grid Control as shown in inage.

Monday, July 4, 2011

Data annotations for validation outside of a UI framework

 
Several people have asked me about using data annotations for validation outside of a UI framework, like ASP.NET MVC or Silverlight. The System.ComponentModel.DataAnnotations assembly contains everything you need to execute validation logic in the annotations. Specifically, there is a static Validator class to execute the validation rules. For example, let's say you have the following class in a console mode application:
 
 

Saturday, July 2, 2011

Lost sql-server password

Here's a neat thing to remember if you're using MSSQL:

To change the "sa" password, login to your computer using an administrator account. Open your SQL Server and log in using Windows Authentication. Open a new query window and type in the following command:

sp_password @new = 'new_password', @loginame = 'sa'
After that go to section Security –> Logins –> double click "sa" or choose properties. Go to "Status" and check to see if "Login:" is enabled. If not, enable it.