Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Type mismatch error
#1
Not Solved
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...
Reply
#2
Not Solved
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?
Reply
#3
Not Solved
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

Reply
#4
Not Solved
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".
Reply
#5
Not Solved
What is the returned row count of the Query ? or try this,

msgbox Query.EOF ? what does it return ?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#6
Not Solved
check whether any record is there in your recordset or not prior to your statement of comparison. try
Code:
if Query.EOF <> True then

Reply
#7
Not Solved
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Different Type of Dropdown Selector zunebuggy 6 2,842 05-01-2018, 06:46 PM
Last Post: zunebuggy
  cannot use the type method on object and submit is not working jove1776 5 8,382 01-27-2015, 10:08 PM
Last Post: Parke
  How to import .xlsx file type to QTP qtped 3 6,323 03-27-2014, 01:33 PM
Last Post: Ankur
  type mismatch error in QTP QAlearningQTP 1 6,810 02-04-2014, 08:14 AM
Last Post: QAlearningQTP
  QTP 11.52---Type mismatch error srinijg20 4 4,126 08-26-2013, 03:51 PM
Last Post: GregHicks

Forum Jump:


Users browsing this thread: 1 Guest(s)