Sunday, November 29, 2009

Login failed for user sa crystal report


Login failed for user sa

In his “Troubleshooting Database Login Errors using Crystal Reports with .NET,” Eric Landes points out that he sees questions regarding the “Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed” message quite often in the newsgroups. That's an understatement. Since I use the “push” method (generating an ADO.NET dataset first, then setting the report's DataSource), I never saw this error, but I decided to try and replicate the problem to see why this was happening--it seems to be a popular error. I had a suspicion that impersonation and the “double hop“ (where the ASP.NET application cannot pass the user's credentials) may play a role in this problem, since the methods in Eric's article don't solve the problem for every user it should.

To replicate the problem, I used an ASP.NET project connecting to either a remote production SQL Server database or a copy of the same database on my development machine (SQL Server Developer Edition). I created a stored procedure that was just a simple SELECT statement, and used this stored procedure as my report source (“pull“ method). I probably created this report 20 different ways, testing various options, and here's what I found.

Saturday, November 28, 2009

Error on Sum in Formula Field, crystal reports , formula ,sum

Error on Sum in Formula Field

When using a formula or expression field to perform a calculation of a set of numbers, you may receive the following error message
!Syntax Error, xxx,xxx
where xxx represents the numbers in the argument.

This error occurs when two or more numbers are separated by a comma without a space and the second and subsequent numbers are three or more digits. For example, the following expressions
will produce the following errors:
!Syntax Error, 123,123
!Syntax Error, 123,123,123
This behavior occurs when the formula field performs the following calculations: SUM, AVERAGE, MIN, MAX, and PRODUCT.

If the expression contains a series of three or more numbers, the second number is one or two digits, and each number is separated by a comma without a space, your results will be inaccurate, and you will not get a syntax error. For example, the following expression
will produce the following result:
This behavior does not occur when you perform calculations based on table cell references or when using bookmarks.

When the comma is not followed by a space but is followed by three digits, Word interprets the comma as being the thousands-place separator and treats the argument as one number.

Place a space immediately following the comma, so that your formula looks as follows:
{=SUM(123, 125)}