Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to fire SQL query on Excel sheet?
#7
Not Solved
Hi

Please check this code:

Code:
Set objConnection = CreateObject("ADODB.Connection")
    Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source="EMP";Extended Properties=""Excel 8.0;HDR=Yes;"";"
strQuery = "Select * From Emp where EmpID IS NOT NULL"
objRecordSet.Open strQuery, objConnection, adOpenStatic, adLockOptimistic, adCmdText
intColCnt = objRecordSet.Fields.Count

Hope this will help you.
Reply


Messages In This Thread
RE: How to fire SQL query on Excel sheet? - by QTPLearn - 08-06-2010, 11:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,783 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
Rolleyes Browse object query Hema a newbie 0 1,896 07-22-2014, 08:37 PM
Last Post: Hema a newbie
  Custom sort -Excel Sheet kiran 1 3,970 01-28-2014, 09:23 AM
Last Post: supputuri
  SQL Query Issue in QTP rajiv.qtp 1 2,592 11-28-2013, 10:36 AM
Last Post: Jay
  Can we save an exported Excel sheet directly from QTP? Akhila 2 3,551 11-28-2013, 10:30 AM
Last Post: Akhila

Forum Jump:


Users browsing this thread: 1 Guest(s)