Bug #11352 Type mismatch when use rs.fields(i).value
Submitted: 15 Jun 2005 13:09 Modified: 25 Jun 2005 20:23
Reporter: Nicolas Paour Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.11.00 OS:Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[15 Jun 2005 13:09] Nicolas Paour
Description:
1- connection script :
Set conn_db = Server.CreateObject("ADODB.Connection")
With conn_db
          .Provider ="MSDASQL"
          .ConnectionString ="DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=mysql;UID=root;PWD=****"
          .Open
End With
   -> result OK
SQL= "select * from user"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open SQL,conn_db , 3, 3
   -> result OK
' return field method 1 
response.write  rs.fields(0).value
   -> result OK
' return field method 2
response.write  rs.fields("host").value
   -> result OK
*** BUG *** BUG *** BUG *** BUG *** BUG ***
' return field method 3
rs.movefirst
Do While Not rs.eof
    For i=0 To rs.Fields.count-1
        Response.Write "<td>" & rs.fields(i).value & "</td>"
   -> Result "Type mismatch" <- BUG 
    Next
    rs.movenext
loop

How to repeat:
When I try to pass Integer parameter "i" in rs.fields(i).value 

Suggested fix:
No idea !!!
[17 Jun 2005 5:39] Vasily Kishkin
Could you please write here definition of table ?
[17 Jun 2005 9:17] Nicolas Paour
Hello,

For this test, I use the default Mysql database (User table):
-- 
-- Table structure for table `user`
-- 

CREATE TABLE `user` (
  `Host` varchar(60) collate utf8_bin NOT NULL default '',
  `User` varchar(16) collate utf8_bin NOT NULL default '',
  `Password` varchar(41) collate utf8_bin NOT NULL default '',
  `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Reload_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Shutdown_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Process_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `File_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Show_db_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Super_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Repl_slave_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `Repl_client_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
  `ssl_type` enum('','ANY','X509','SPECIFIED') collate utf8_bin NOT NULL default '',
  `ssl_cipher` blob NOT NULL,
  `x509_issuer` blob NOT NULL,
  `x509_subject` blob NOT NULL,
  `max_questions` int(11) unsigned NOT NULL default '0',
  `max_updates` int(11) unsigned NOT NULL default '0',
  `max_connections` int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges';
[20 Jun 2005 7:58] Nicolas Paour
Temporary workaround, add:
<%
on error resume next
%>
[20 Jun 2005 8:55] Vasily Kishkin
As far as I can understand VB can't concat string with byte array. I mean blob fields in table. Could you please say me what value of "i" is when you got the error ? I attached test case and you can use it for testing.
[20 Jun 2005 8:56] Vasily Kishkin
Test case

Attachment: 11352.zip (application/x-zip-compressed, text), 3.13 KiB.