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

I would like to fire SQL queries through QTP...like
(1) Sorting, Count, Avg.....etc and also queries like
(2) Union, UnionAll....etc on Excel sheet columns.

Can anyone please suggest suitable code/script for that.


Thanks
Shrini
Reply
#2
see if this post helps you
https://www.learnqtp.com/qtp-database-ch...ving-data/

Reply
#3
Hi Saket,

Thanks for the link. Yes it will surely helps in getting idea about how to fire SQL query on databases. But my requirement belongs to firing queries like Avg, Count, Sort....and more importantly Union and UnionAll.

So request you to please give a script with examples i.e firing above mentioned queries; so that i and many of LearnQTP family members will get exact idea about it.

Thanks for your gr8 support in advance...

Regards,
Shrini
Reply
#4
Hi,

Can anybody please resolve my above query....its urgent.

Your help is much appriciated.

Thanks
Shrini
Reply
#5
Anybody please reply....
Reply
#6
Hi Sasmita,

External links are not allowed here, if you know the answers, please post it here.
regarding this thread - Shriqtp want to know about firing query with excel functions like Avg, Count, Sort, which I think is not possible to use directly using ADO.

Reply
#7
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


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 2,160 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
Rolleyes Browse object query Hema a newbie 0 2,163 07-22-2014, 08:37 PM
Last Post: Hema a newbie
  Custom sort -Excel Sheet kiran 1 4,456 01-28-2014, 09:23 AM
Last Post: supputuri
  SQL Query Issue in QTP rajiv.qtp 1 2,953 11-28-2013, 10:36 AM
Last Post: Jay
  Can we save an exported Excel sheet directly from QTP? Akhila 2 4,010 11-28-2013, 10:30 AM
Last Post: Akhila

Forum Jump:


Users browsing this thread: 1 Guest(s)