.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘command’

Error when you try to call the Prepare method before you add parameters: “An unhandled exception of type ‘System.Data.SqlClient.SqlException’ occurred in system.data.dll”

Symptoms
When you create a parameterized command against Microsoft SQL Server 7.0, if you call the Prepare method before you add parameters to the command, you receive the following error message:

An unhandled exception of type ‘System.Data.SqlClient.SqlException’ occurred in system.data.dll.
Additional information: System error. This problem does not occur in SQL Server 2000.
Resolution
This problem occurs in SQL Server 7.0 because, by design, you cannot run the Prepare method before you add parameters. This applies to most database systems.
SQL Server 2000 does not generate the above-mentioned exception because it does not run Prepare until the first command is executed. This optimization prevents the overhead of Prepare if no commands are subsequently executed.

BUG: Report Preview with Form’s Name Clears Object Reference

Symptoms
Issuing a REPORT FORM PREVIEW command on a report that has the same filename as a form that is running causes the form to lose its objectreference. If you attempt to reference the form object in code, this errormessage appears:

Object not found
Resolution
If you have a form called Customer and issue the following command, anobject reference named Customer is created for the form:

DO FORM Customer Preview a report named Customer by issuing the following command:

REPORT FORM Customer PREVIEW The customer object now references the Report Preview window. When theReport Preview window is closed, the customer object is released. Workaround this problem by giving your forms a different object reference thanthe reports with the same name. Do this by using the NAME clause in the DOFORM command. For example, to give the Customer Form an object reference ofCustform, you would issue the following command:

DO FORM Customer NAME Custform

“Fatal Exception 0D” Using Copy Disk Command

Symptoms
When you use the Copy Disk command in My Computer or Windows Explorer, youmay receive the following error message after you insert the destinationdisk and click OK:

Fatal Exception 0D has occurred at <address> in VxD V86MMGR (01)+
In addition, the Performance tab in the System tool in Control Panel mayindicate that your floppy drives are using MS-DOS Compatibility mode.
Resolution
This behavior can occur if the Hsflop.pdr file is missing or damaged.