Micro Focus QTP (UFT) Forums
Type mismatch error - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Type mismatch error (/Thread-Type-mismatch-error)



Type mismatch error - egun - 08-26-2009

Error I get:
Type mismatch: 'Output'
Line (25): "Output Query.GetString".

My code:
Code:
valueHID = Datatable.Value("HID_out")
sql = "SELECT rev_id FROM bh INNER JOIN clue ON bh.clue_id = clue.clue_id WHERE h_id = " & valueHID

set Query = dbexample.execute(sql)
Output Query.GetString
msgbox Output

I'm trying to output the value via msgbox that is received from the sql statement above. The rev_id returned is of type Int. Thanks! Would appreciate the help...


RE: Type mismatch error - egun - 08-27-2009

I also tried to compare Query to another integer, which is not working either.

For instance:
If Query = 380 Then

I'm just trying to get the value that the sql statement returns to use elsewhere. Seems like everything I've tried I get a Type mismatch error. What is the datatype of Query that contains the output of the sql?


RE: Type mismatch error - Saket - 08-27-2009

I observed that you are missing '=' in the statement where you are getting the error.
I believe, you are taking 'Output' as a variable in which you are trying to get the output of 'Query.GetString'

Try this in your code
Code:
Output = Query.GetString
msgbox Output



RE: Type mismatch error - egun - 08-27-2009

Thanks, that part is working now. But then I do a comparison and I'm getting a different error now.

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Line (29): "If Query.GetString = "380" Then".


RE: Type mismatch error - basanth27 - 08-27-2009

What is the returned row count of the Query ? or try this,

msgbox Query.EOF ? what does it return ?


RE: Type mismatch error - Saket - 08-27-2009

check whether any record is there in your recordset or not prior to your statement of comparison. try
Code:
if Query.EOF <> True then



RE: Type mismatch error - egun - 09-03-2009

The row count should be 2, so maybe this is where the problem is!? How do I handle multiple results?
My issue has been fixed, thank you for your help.