Bug #32028 Error when i print binary values with concatenate
Submitted: 1 Nov 2007 12:24 Modified: 9 Nov 2007 12:52
Reporter: Dayvison Pellegrina Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.21 OS:Windows (2003 Server IIS6)
Assigned to: CPU Architecture:Any

[1 Nov 2007 12:24] Dayvison Pellegrina
Description:
When i try to print a "binary" value using the object "response.write" and concatenate a
string value, i receive an error:

"Microsoft VBScript runtime error '800a000d' 
Type mismatch 

The instruction with error:
<%
Response.Write rs(1)   & " Chupa-Cabras"
%>

The instruction without error:
<%
Response.Write rs(1)
%>

I try to using a another driver and i getting successful with 3.51.12 version using the
same code. So I think this is a kind of  bug, someone already had this problem ?

Thanks =D
Dayvison Pellegrina

How to repeat:
The example code:
<%
Set con = Server.CreateObject("ADODB.Connection")
con.open "Driver={MySQL ODBC 3.51 Driver}; (...) "

set rs = con.execute("SELECT NTeste, Teste FROM Teste")

While not rs.eof 
	response.write rs("NTeste") & "<br>"
	response.write " - "
	response.write rs("Teste") & "<br>"
	response.write "<br>"

	rs.movenext
wend

	

rs.close
con.close

Set rs= Nothing
Set con = Nothing
%>

The Database:
MySQl Version: 5.0.41

Table:
CREATE TABLE `Teste` (
  `NTeste` int(11) NOT NULL,
  `Teste` binary(1) NOT NULL default '0',
  PRIMARY KEY  (`NTeste`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

Data:
INSERT INTO `Teste` VALUES(1, '0');
[1 Nov 2007 12:41] Dayvison Pellegrina
With the version 3.51.19 does not work too.
[1 Nov 2007 17:00] Susanne Ebrecht
Hello Dayvison,

many thanks for writing a bug report.

Kind Regards,

Susanne
[1 Nov 2007 17:01] Susanne Ebrecht
Bug #32027 is a duplicate of this bug here.
[5 Nov 2007 12:56] Tonci Grgin
Hi Dayvison. On a first look I would call this expected behavior. You might take a look into conversion routines used by ADO like CInt, CDbl and others and find one suitable for you to use or CAST "Teste" as CHAR explicitly. I will need some time to verify this though.
[5 Nov 2007 15:43] Dayvison Pellegrina
I was making some tests and noticed that this really should be the same behavior expected. Since we have 2 types of different variables, a concatenation only would an error in the "type mismacth". I tested with a database SQL-Server 2000 and the behavior is similar to what we have in versions 3.51.21 / 3.51.19. 

The only thing strange is the behavior of older driver (3.51.12), which should return some kind of value “character” to data type “binary”. 

As for the type of variable to be used in the concatenation, we will check the function more appropriate for the same.

I think it is occurrence can be closed. If you have more information that could help me I would greatly. 

Thanks again =D
[9 Nov 2007 12:52] Susanne Ebrecht
Hi Dayvison,

many thanks for you help.
I'll close this bug report now.

Thank you for trusting MySQL.

Susanne