Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exporting QTP runtime datatable to SQL server during
#1
Not Solved
Hi Team,

I am importing datatable from sql server in the global sheet, then modifying few column data.
After modification, I want to write back the changes(runtime datatable) to the same datatable in the sql server database.

Is it possible to do? If yes, can you please suggest a sample code.
Reply
#2
Not Solved
Its possible. given the Update access previlages to your DB.
i dont have sample code.
bt u can do this in similar way how you caonnect to the DB and query the DB


U can write a update query and execute it.

Thanks
Sonu
Code:
Function db_connect( strSQL )
        Set o_CON =CreateObject("ADODB.Command")
        Set o_RS= CreateObject("ADODB.RecordSet")
        serverName =  Left(Environment.Value("LocalHostName"), 4)&"svr"'Inputbox("Enter the DB server Name")
        If Trim( serverName)  ="" Then
            's_ConnectionString =  "dsn=" & "yourDB"
            serverName ="yourdbserver"
            s_ConnectionString ="driver=sql server;server="& serverName  &";database=yourDB;uid=yourdbuserid;pwd=yourpassword*"
        Else
         s_ConnectionString ="driver=sql server;server="& serverName  &";database=yourDB;uid=yourdbuserid;pwd=yourpassword*"
        End If
        
        o_CON.ActiveConnection = s_ConnectionString
        o_CON.CommandText= strSQL
        Set o_RS =o_CON.Execute
        Set db_connect = o_RS
End Function
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SQL Query Issue in QTP rajiv.qtp 1 2,272 11-28-2013, 10:36 AM
Last Post: Jay
  Does QTP support writing runtime data to multiple sheets in excel Shwethareddy 2 3,531 10-16-2012, 12:20 PM
Last Post: Shwethareddy
  Coloring cell of runtime datatable indranilgoswamimcb 3 10,640 08-03-2012, 03:51 PM
Last Post: SteveS
  SQL on oracle database doesn't return a value Bluefields 2 3,049 07-09-2012, 01:23 PM
Last Post: Bluefields
  Exporting datatable Sivapratha 1 2,901 04-08-2011, 07:37 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)