I have 2 questions:

1. I am trying to enter a sql statement in an Excel spreadsheet that I import into QTP. Here's the sql:

select cntl_id from dba.so_pick_detail where so_id = 200708 and dist_id = 15 and ship_id = 01

The sql statement is in the imported Excel spreadsheet in a column called cntl_id

The first thing I want to do is make the so_id read the value in column C1 in the same excel spreadsheet instead of being hardcoded as 200708. The same thing with dist_id = value in D2 and ship_id = value in E2.

2. Once I get that working correctly I need to execute the sql statement in QTP.
I've played with the syntax and so far nothing has worked. Here's what I have right now:
Set objResult = objDB.Execute (DataTable, "cntl_id", dtGlobalSheet)

I keep getting a Run Error message "Type mismatch"

I've tried putting " around the values in the sql statement above and also removing them. Both situations return the Type mismatch error message. I assumed it was referring to a field type mismatch in the database but is this a QTP type mismatch instead?

Here's the entire script as is right now:

' Load Order numbers to process from GC spreadsheet
DataTable.ImportSheet "N:\Qcteam\Automation Info\WMSOrderNo\WmsOrdNo.xls", 1, Global

'Define the objDB object
Dim objDB
Dim objResult
Dim CntlId


'Create a database object
Set objDB = CreateObject("ADODB.Connection")
'Set objRecordSet = CreateObject("ADODB.RecordSet")



'open the session to the database
objDB.ConnectionString = "DSN=WMGLFT"

'wait(180)
objDB.Open "DSN=WMGLFT"

'query="Select cntl_id from dba.so_pick_detail where so_id = '200708' and dist_id = '15' and ship_id = '01'"
'Set objResult = objDB.Execute(query)
'objRecordSet.Open "Select cntl_id from dba.so_pick_detail where so_id = '200708' and dist_id = '15' and ship_id = '01'", objDB, adOpenStatic, adLockOptimistic

'run sql query
'Set objResult = objDB.Execute("Select cntl_id from dba.so_pick_detail where so_id = '200708' and dist_id = '15' and ship_id = '01'")
Set objResult = objDB.Execute (DataTable, "cntl_id", dtGlobalSheet)

'Examine the query results
Do Until objResult.EOF
CntlId=objResult.Fields("cntl_id")
Reporter.ReportEvent micDone, "cntl_id", "The Cntl_id is " & CntlId
objResult.MoveNext

Loop

Any help you can provide would be reatly appreciated.

Thanks!
Susan