Visual Basic Q&A

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 ‘default’

BUG: The Visual Basic .NET or Visual Basic 2005 Upgrade Wizard reports an incorrect warning message for user-defined data types

Symptoms
If you use Visual Basic Upgrade Wizard on your Microsoft Visual Basic 6.0 project with a user-defined data type, the wizard generates a warning message for the code with user-defined data type assignments. For example, you may receive the following warning message for a direct user-defined data type assignment.

UPGRADE_WARNING: Could not resolve default property of object <<UDT>>. Click for more information: ‘ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword=”vbup1037′
Resolution
The wizard incorrectly treats the user-defined data type variables as a class object, and then tries to locate the default property for the object. The user-defined data type does not have default properties. Therefore, the wizard cannot locate a default property, and it reports an incorrect warning.

PRB: Error When You Create SQL Server TEMP Tables Using Remote Data Objects (RDO)

Symptoms
When you create a SQL Server local temporary table using the rdoConnection object by calling its .Execute method with default parameters, and then attempt to access the table after the Remote Data Objects (RDO) method has run, you may receive one of the following error messages:

Run-time error ‘40002′: 37000:[Microsoft][ODBC SQL Server Driver][SQL Server] Statement(s)could not be prepared
-or-

Run-time error ‘40002′: S0002:[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid Object Name ‘#<Name of the temporary table>’
Resolution
The creation and use of temporary database tables to facilitate the storage and manipulation of volatile intermediate data is a common programming practice. The default behavior of the SQL Server Open Database Connectivity (ODBC) driver is to create and use temporary stored procedures to run prepared statements. The .Execute method of the rdoConnection object uses the SQLPrepare() and SQLExecute() ODBC application programming interface (API) calls by default to run a SQL statement as a prepared statement. Temporary tables that are created by a stored procedure are automatically dropped when the procedure completes execution. As a result, when you attempt to access a SQL Server temporary table that was created by calling the .Execute method of an rdoConnection object with default parameters, in subsequent statements you receive one of the error messages specified in the “Symptoms” section.

BUG: “System.MissingMethodException” error message when you try to build an application that hosts a licensed class

Symptoms
If you try to build an application that hosts a licensed class, and the application does not have a default (parameter-less) constructor, you receive an error message that is similar to the following:

Could not transform licenses file ‘licenses.licx’ into a binary resource. (1) : error LC0004 : Exception occured creating type ‘System.MissingMethodException’ Note In this error message, the word “occured” is a misspelling of the word “occurred.”
Resolution
To resolve this problem, add a default (parameter-less) constructor to the licensed class and then rebuild the licensed class library.