Archive

Archive for June, 2008

ExecuteNonQuery always returns -1

June 24, 2008 amiraryani Leave a comment

In a web-application I used checking the affected rows in each transaction to avoid unexpected situations which data can be changed by other sources. This is the case that your application is not the only one which reads and writes to the database, and using lock on the records is not possible (matter of performance or personal preference).

However, after installing in the production environment we found that application does not work. The ADO ExecuteNonQuery always returns -1 instead of actual affected records count.

Further search showed that there is a T-SQL command that can disable returned affected record counts. According to Microsoft:

SET NOCOUNT { ON | OFF } : Stops the message indicating the number of rows affected by a Transact-SQL statement from being returned as part of the results” Reference: http://msdn.microsoft.com/en-us/library/aa259204(SQL.80).aspx

The NOCOUNT command can be used in Store Procedures and Triggers, but the application did not have either of them, so it must be something else.

Finally I found the cause of the problem in the following forum post:

http://www.developersdex.com/sql/message.asp?p=581&ID=%3C%23Guu6msqIHA.3568%40TK2MSFTNGP04.phx.gbl%3E

Default NoCount parameter is in SERVER PROPERTIES > CONNECTIONS > DEFAULT CONNECTION OPTIONS LIST

The following screen shot is from SQL Server 2000. To fix the problem and make ExecuteNonQuery returns the correct affected records number be sure that the NoCount is not ticked.

image

Categories: SQL Server

Error in File UNKNOWN.RPT

June 20, 2008 amiraryani 8 comments

Crystal Report can be sometimes very tricky. When we faced the following bizarre  error message on a ASP.Net 2 web sites using Crystal 11, we learned that there are unknown undocumented secrets about distributing Crystal object.

Error in File UNKNOWN.RPT: The request could not be submitted for background processing.

We installed a web-application which was working fine on development environment on a Windows 2000 Server and we got following error message:

As far as we know there was no UNKNOWN.RPT in our project so we start searching the web for any hint about the source of the problem. There are number of posts on ASP.Net forum and other web sites about similar problems.

Finally after lots of research, following article turned to be helpful and fixed our problem. Interestingly the error message does not mach the actual addressed issue in the article, also we used Crystal 11, but this article is about Crystal 10.

BusinessObjects: https://boc.sdn.sap.com/node/231%23comment-2457/    (Comment (July 2009)/ this article is no longer available in BusinessObject website.)

Synopsis
A Microsoft Visual Studio .NET application uses Crystal Reports 10 for Visual Studio .NET SDK as the reporting development tool.

When the application is deployed to a computer that does not have a C drive, the following error message appears:
“Load Report Failed”

Why does this error message appear and how can it be resolved?
It is common to not have a C drive on Terminal servers and Citrix servers.

Solution
This error message appears because the application sets registry values that point to the C drive. To resolve the error message, use the following steps to change these registry values in the Registry Editor.

1. On the ‘Start’ menu, click ‘Run’.
2. In the ‘Run’ dialog box, type “Regedit” then click ‘OK’.
3. In the Registry Editor browse to the following subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Crystal Decisions\10.0\Report Application Server\InprocServer\LocalConnectionMgr
4. Right-click the ‘ConnectionDirectoryPath’ string value, then click ‘Modify’.
5. In the ‘Value data’ text box, change “c:\” to the drive letter where the following directory exists (You may need to search your computer to find where this directory exists):
\Program Files\Common Files\Crystal Decisions\2.5\bin
Click ‘OK’.
6. Right-click the ‘LocalConnectionMgr’ subkey, click ‘New’ then click ‘String Value’.
7. Name this String Value “ReportDirectoryPath”.
8. Right-click the ‘ReportDirectoryPath’ string value and click ‘Modify’.
9 In the ‘Value data’ text box, type the same drive letter as you typed in step 5.
====================
NOTE:
After making changes to the registry, restart the affected service or application as required.

Well I will add this solution to my support notes and I guess this is one of those issues that I will face it again on different platforms of windows. The whole problem sounds like a bug and I do not know why BusinessObject hasn’t release any patch to fix it.

Categories: Crystal Report

Mac shortcuts

If you use mac you will find the list of keyboard shortcuts quite handy:

Command:
Control:
Shift:
Option:
Function:   F
Escape:

Copy a folder or file:Command + C

Paste a folder or file:Command + V

Cut to clipboard:Command + X

Search or Find: Command + F

Force quit an application: Command + Option + Esc

Capture screen: Command + Control + Shift + 3

Find properties: Command + I

Print: Command + P

Quit a program :Command + Q

Save a file: Command + S

Toggle between applications: Command + Tab

Swith to next window: Command + ~

Undo: Command + Z

Select all items: Command + A

Rename a folder: Select item + Enter

New folder:Command + N

Instead of Crl +Alt +Del:

Force Quit an application: Option + Command + Esc

Quit all applications and restart: Control + Command + Eject

Prompt Restart, Sleep, Shutdown box: Control + Eject

Sleep mode: Option + Command + Eject

Start-up/boot commands:

Boot from disc:C

Start in Firewire target disc mode:T

Safe boot:Shift

Choose start-up disc: Option

Seek a different start-up volume: Command + Option + Shift + Delete

Start-up in single-user mode: Command + S

Start-up in Verbose mode: Command + V

 

For a complete list look at the following article on CNet:

Reference http://www.cnet.com.au/desktops/pcs/0,239029439,339289468,00.htm

Categories: Mac OS X