PRB: 80004005 Unspecified Error When Passing Disconnected Recordset from MTS to ASP
ID: Q237536
|
The information in this article applies to:
-
Microsoft Data Access Components versions 2.0, 2.1, 2.1 (GA), 2.1 SP1, 2.1 SP2
-
Microsoft Internet Information Server versions 4.0, 5.0
-
Active Server Pages
-
Microsoft Transaction Server 2.0
SYMPTOMS
When passing a disconnected ActiveX Date Objects (ADO) Recordset from a Component Object Model (COM) component inside a Microsoft Transaction Server (MTS) Server Package to Active Server Pages (ASP), you may receive one of the following error messages:
error '80004005'
Unspecified error
/xxx.asp, line x
-or- (with ASP error handling)
Error Number : 13 - Source : Microsoft VBScript runtime error - Type mismatch
-or- (after multiple tries)
Microsoft VBScript runtime error '800a0007'
Out of memory: 'obj.TestRS'
/xxx.asp, line x
CAUSE
An error occurs because the fields in the disconnected recordset have been defined as adVariant, and ADO cannot marshal certain data types within adVariant across process boundaries (in this case, between InetInfo and MTS). ADO marshaling cannot convert data of the following types when the field type is set to adVariant:
DBTYPE_BSTR = 8,
DBTYPE_IDISPATCH = 9,
DBTYPE_VARIANT = 12,
DBTYPE_IUNKNOWN = 13,
DBTYPE_ARRAY = 0x2000,
DBTYPE_BYREF = 0x4000,
Please note that the following types are not to be used for Automation when using adVariant, as documented (see the
Microsoft Data Access Components 2.5 SDK Beta - OLE DB Programmer's Reference in the July 1999 edition of the MSDN library):
// The following values exactly match VARENUM
// in Automation but cannot be used in VARIANT.
DBTYPE_I8 = 20,
DBTYPE_UI8 = 21,
DBTYPE_GUID = 72,
DBTYPE_VECTOR = 0x1000,
DBTYPE_FILETIME = 64,
DBTYPE_RESERVED = 0x8000,
RESOLUTION
When trying to pass values of the types mentioned above, such as strings (BSTR), you must declare those field types explicitly instead of using adVariant.
Example
rs.Fields.Append "ID", adVariant 'this works since it is an Integer
rs.Fields.Append "fname", adVarChar, 50
rs.Fields.Append "lname", adVarChar, 50
MORE INFORMATIONSteps to Reproduce Behavior
- In Microsoft Visual Basic 6.0, create a new ActiveX DLL project.
- Add the following references to the project:
Microsoft Transaction Server Type Library
Microsoft ActiveX Data Objects 2.x Library
- Copy and paste the following code into the Class Module:
Public Function TestRS() As Variant
Dim rs As ADODB.Recordset
Set rs = GetObjectContext.CreateInstance("ADODB.Recordset")
rs.Fields.Append "ID", adVariant
rs.Fields.Append "fname", adVariant
rs.Fields.Append "lname", adVariant
rs.CursorLocation = adUseClient
rs.Open
rs.AddNew
rs(0) = 1
rs(1) = "Yuri"
rs(2) = "Lausberg"
rs.Update
Set TestRS = rs.Clone
rs.Close
Set rs = Nothing
GetObjectContext.SetComplete
End Function
- Set the Class Property MTSTransactionMode = 1 NoTransactions.
- Compile the DLL.
- Add the DLL to an MTS Server Package.
- Copy and paste the following ASP script into a new ASP file.
<%
On Error Resume Next
Set obj = Server.Createobject("project1.class1")
Set rs = obj.TestRS
Response.Write rs(1)
If Err.Number > 0 Then
Response.Write "<B>Unable to read field value</B><P>"
Response.Write "Error Number : "& Err.Number
Response.Write " - Source : " & Err.Source
Response.Write " - " & Err.Description & "<P>"
Else
Response.Write rs(2)
End If
rs.Close
Set rs = Nothing
%>
- Request the ASP file from a browser, and the following error appears:
Unable to read field value
Error Number : 13 - Source : Microsoft VBScript runtime error - Type mismatch
Additional query words:
Keywords : kberrmsg kbADO kbASP kbCOMt kbMDAC kbMTS kbMTS200 kbIIS kbMDAC210 kbMDAC210SP2 kbMDAC250 kbCodeSnippet kbiis400 kbiis500
Version : WINDOWS:2.0,2.1,2.1 (GA),2.1 SP1,2.1 SP2; winnt:2.0,4.0,5.0
Platform : WINDOWS winnt
Issue type : kbprb
|