Microsoft KB Archive/264242

= BUG: Parameterized Insert of LongVarBinary Data Type Can Return &quot;Type Is Invalid&quot; Error =

Article ID: 264242

Article Last Modified on 12/5/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.1
 * Microsoft Data Access Components 2.5
 * Microsoft ActiveX Data Objects 2.1
 * Microsoft ActiveX Data Objects 2.5

-



This article was previously published under Q264242



SYMPTOMS
When you attempt a parameterized insert of an SQL_LONGVARBINARY (adLongVarBinary) data type with the ActiveX Data Objects (ADO) command object, the following error message may be returned:

Type is Invalid

This problem occurs with the Microsoft Visual FoxPro driver, or with any of the Microsoft Jet Indexed Sequential Access Method (ISAM) drivers.



CAUSE
The Microsoft OLE DB Provider for ODBC (MSDASQL) assumes a data type of SQL_BINARY (and not SQL_LONGVARBINARY). The Visual FoxPro and Jet ISAM drivers do not support the SQL_BINARY data type.



RESOLUTION
In the case of the Jet ISAM drivers, you can resolve the problem by using the native Microsoft Jet 4.0 OLE DB Provider, which does support the SQL_BINARY type. There is no known workaround for the Visual FoxPro driver.



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



Steps to Reproduce Behavior
Create a data source name (DSN) named &quot;dBaseFiles&quot; that points to any folder, and specify &quot;dBase 5.0&quot; as the type. Run the following code to create a table and attempt an insert: Private Sub Form_Load Dim cn As New ADODB.Connection Dim cmd As New ADODB.Command Dim param As ADODB.Parameter cn.Open &quot;DSN=dBaseFiles&quot; 'cn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data   'Source=C:\dBase;Extended Properties=dBase 5.0;Persist Security Info=False&quot;

cn.Execute &quot;CREATE TABLE test (col1 oleobject)&quot;

cmd.ActiveConnection = cn   cmd.CommandText = &quot;insert into test values (?)&quot; Dim arr(10) As Byte arr(0) = 1 arr(1) = 2 Set param = cmd.CreateParameter(, adLongVarBinary, adParamInput, UBound(arr) + 1, arr) cmd.Parameters.Append param cmd.Execute cn.Close Stop End End Sub To correct the problem, comment the line cn.Open &quot;DSN=dBaseFiles&quot; and uncomment the line that follows it.

Additional query words: blob adBinary adLongVarBinary iisam paradox dbase foxpro

Keywords: kbbug kbdatabase kbjet kbdbase kbpending KB264242

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.