BUG: MSDAIPP Provider Does Not Deny The Assignment of an Integer Value to an Array Typed Column (245498)



The information in this article applies to:

  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7

This article was previously published under Q245498

SYMPTOMS

When you assign an integer value to an Array typed field, the Microsoft Internet Publishing Provider (MSDAIPP) does not deny the assignment and the following error message occurs when you try to retrieve the field's value:
Run-time error # 13:   Type mismatch

RESOLUTION

Make sure that your data types are compatible before you assign any value to a given field.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

The following Microsoft Visual Basic sample code demonstrates:

  • The creation of an array field, rec("x").

  • The assignment of an integer value (zero) to rec("x"). In this case, ActiveX Data Objects (ADO) takes the (zero) value and assigns it as the current value of the rec("x") field without returning an error message.

  • The retrieval of the rec("x") field's value, where you get a "Type mismatch" error message.

Steps to Reproduce Behavior

  1. Create an empty text file named Text.txt on <Name_of_Your_Web_Server>.
  2. Start a new Visual Basic Standard EXE project. Form1 is added by default.
  3. From the Project menu, click References, and then select the "Microsoft ActiveX Data Objects 2.5 Library".
  4. Place the following code in the General Declaration section of Form1:
    Private Sub Command1_Click()
    
    Dim rec As New Record
    
    rec.Open "http://<Name_of_Your_Web_Server>/test.txt", , adModeReadWrite, adCreateOverwrite
       
    rec.Fields.Append "x", adArray + adVariant
    rec("x") = Array(1, 2)
    
    Debug.Print rec("x")(0), rec("x")(1)    ' This returns: 1, 2
    
    rec("x") = 0                        ' <--- WRONG: Assigning an integer to an array column 
    
    Debug.Print rec("x").Type           ' This returns 8204 (stands for adArray + adVariant data-type)
    Debug.Print rec("x")(0)             ' Error 13 occurs here
    
    rec.Close
    
    End Sub
    					
  5. Run the code to see the error message occur.

REFERENCES

Platform SDK Online Help


Modification Type:MajorLast Reviewed:5/8/2003
Keywords:kbBug kbpending KB245498